Jump to content
rayj00

<i Tag Question used in Smarty

Recommended Posts

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

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...