rayj00 Posted May 15, 2018 Share Posted May 15, 2018 Keep in mind I am not a web designer or PHP or Smarty developer. So, I have this smarty.tpl script that I am trying to figure out how the code flows. It uses smarty for creating templates. Within the file is an <i html tag. Researching it at https://www.w3schools.com/tags/tag_i.asp tells me it is used for styling text. However, I have the following: <i class="fa fa-video fa-fw js_x-uploader" data-handle="publisher" data-type="video"></i> {__("Add Video")} </span> My question is: It appears that the js_x-uploader affects what happens when I click on a link. The button is the "Add Video" button in a drop down menu. When I click the "Add Video" button a windows explorer pops and I pick a mp4 video to post to a page timeline. When I change the js_x-uploader to something else, arbitrarily, the win explorer does not pop. I am confused as to why js_x-uploader acts like this. There is nothing in w3school that explains this action for the <i tag? I hope I articulated my question enough? Thanks, Ray Link to comment Share on other sites More sharing options...
Ingolme Posted May 15, 2018 Share Posted May 15, 2018 It has nothing to do with the <i> tag itself. The Javascript library just looks for any elements with certain class names and replaces them with videos, links and other things. Any other element could have been used, but <i> was probably chosen because it's very short and has no semantic meaning. Everything you know about HTML, Javascript can break it. If you want to understand all of this better you will have to learn Javascript in depth. Link to comment Share on other sites More sharing options...
rayj00 Posted May 16, 2018 Author Share Posted May 16, 2018 Interesting. So where are these elements actually defined? How did JS know that the js_x-uploader meant to bring up a windows explorer window? Thanks, Ray Link to comment Share on other sites More sharing options...
Ingolme Posted May 16, 2018 Share Posted May 16, 2018 Javascript searches for all elements on the page that have a certain value in their class attribute. Then it puts another element next to it. To open a file dialog, you just need a file type input, like this: <input type="file"> The Javascript library is putting one of those in the place of the original <i> element. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now