I am trying to render the name of an uploaded file without displaying the full url path i.e. replace '/portal/documents/Doc1.docx' with 'Doc1'. I am using the razor template files that come with the install package and my razor file field is called 'q.Link'. From screenshot, I want to display file name only from 'File:673'.
Also, is there a way to auto display the selected font awesome icon from the 'FileType' option above? Is it possible to display a certain icon if a certain file is uploaded i.e. .docx uploaded then 'fa-file-word-o' displays to screen just left of file name 'Doc1' (currently I am getting user to select an icon from a dropdown list but looking to skip this hopefully unnecessary step)?
Yes you can, but you'll need to write a bit of code to do that automatically - basically checking the file name.
There's actually a template which already does some of this quite nicely - in the standard Bootstrap 3 Content-templates. Install them and check out the _Helpers.cshtml which is in charge of the icon-resolution.
https://github.com/2sic/2sxc-content-bootstrap3/blob/master/_Helpers.cshtml
Related
I am using a bootstrap template for a webpage. I want to customise certain parts of it, but I am struggling to find the CSS rules that relate to the HTML classes because the .css file is so large!
All I can find when searching the web for a solution is ways to search for files rather than within them. It looks as if there was an extension that may have worked, but it doesn't seem to exist any longer.
any help would be hugely appreciated.
You can search over files in VS Code using CTRL/SHIFT/F, more info here
This is from the website:
VS Code allows you to quickly search over all files in the currently opened folder. Press Ctrl+Shift+F and enter your search term. Search results are grouped into files containing the search term, with an indication of the hits in each file and its location. Expand a file to see a preview of all of the hits within that file. Then single-click on one of the hits to view it in the editor.
The simplest way to "find the CSS rules that relate to the HTML classes" is still to open your template/website in a browser -> right click the page and "Inspect Element" -> Find the HTML you need to inspect -> You'll have all the CSS classes and rules involved into styling it ...in the sub-tab "Styles".
simple just "ctrl+f" and type whatever you want to search inside text box show on top right corner.
I am creating a personal learning website. It will contain many "lessons" and I would like to be able to use a menu for every active "lesson", so that the user could go to the next "lesson" without going back to the menu to select it.
To do that, I would need an extern file to modify once and for it to be "called" on every "active" page on the website.
I tried using the -object tag- in html, but it does not work with the template i am using and I would still have to modify the size of the window on every page it appears in.
For some unknown reason, I could not make the third-party method shown on w3s work, and neither the jQuery method I found on similar questions.
Im setting up a custom field on the woocommerce product page to allow featured content to be added, it needs to upload an image and single line of text, unless there is a better way i have it currently set to load an image as 1 field and the second field is text Product fields img and its appearing on the front end like this img of frontend is there an extra step needed to make an image get displayed instead of the path?
Theres no code that i have typed, i have acf installed in wordpress, and a pagebuilder which you choose the field and put it into, its using visual composer. visual composer - page editing
either something is wrong with the plugin or i have set it up incorrectly in acf, although i dont think its overly complex in acf.
I would like to know if there is a program that can reference a converted image file to the actual html?
What I mean is that normally when you save a html page, there will be image saved in the folder together with the html. Suppose that I need to convert the image to some other type (example from gif to jpg), then the actual html saved that contains that image will be lost since the image has been converted. I wanted to view the same html page with the image converted and the html page will still display the same image. As such, back to the question, i wonder if such program exists?
I have tried to google it but I have found no such program exists.
What's wrong with just changing the relevant src attribute in the html file?
Hai,
I have one file upload form in an HTML file. The code is like:
<form>
Select File:<input type="file">
</form>
How can I have only one button (or a link) to upload a file, without having this normal textfield and a browse button? GMail achieves this, but I don’t know how.
How about this http://www.shauninman.com/archive/2007/09/10/styling_file_inputs_with_css_and_the_dom
There is a Yahoo User Interface uploader, see http://developer.yahoo.com/yui/uploader/
It requires flash on the browser, though.
JQuery UI also has a customized file uploader: http://wiki.jqueryui.com/w/page/12137894/FileUploader
That's going to involve JavaScript.
Simple. Here is how it goes. First you create a dummy button element or an anchor element. Set its z-index to 1. Place the file upload (<input type='file' >) over the aforementioned anchor or button element(dummy) and set opacity filters for the file upload to zero and z-index to be 2. Now it will appear as though ur link or button or image is being clicked. Whereas the file upload layer on top is the one that is being clicked hence you will get your File upload dialog. (Positioning the file upload element can be done with css easily.)
If you are using jQuery, have a look at this plugin - https://github.com/ajaxray/bootstrap-file-field
This tiny plugin will display the file input field as a bootstrap button (no text field), similar in all browser and will show selected file names (or selection errors) beautifully. Check their live demo.
Additionally you can set various restrictions using simple data-attributes or JS settings. e,g, data-file-types="image/jpeg,image/png" will restrict selecting file types except jpg and png images.
If you want to get rid of the field next to the “Choose file” button, you’ll pretty much have to code your own file upload field using the JavaScript File API, or (if you need to cater for older browsers that don’t support it) a browser plug-in like Flash.
Web browsers generally decide how they display HTML form controls. This is actually quite good, as it means the fields look the same on different websites, which means users can be confident that they know what the controls do.