Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is x-tmpl?
    primarykey
    data
    text
    <p>Was looking for the answer on the net, but couldn't find anything. This little snack of code really frustrates me, as I can't understand it. (It's part of the plugin called: jQuery File Upload)</p> <pre><code>&lt;script id="template-download" type="text/x-tmpl"&gt; {% for (var i=0, file; file=o.files[i]; i++) { %} &lt;tr class="template-download fade"&gt; {% if (file.error) { %} &lt;td&gt;&lt;/td&gt; &lt;td class="name"&gt;&lt;span&gt;{%=file.name%}&lt;/span&gt;&lt;/td&gt; &lt;td class="size"&gt;&lt;span&gt;{%=o.formatFileSize(file.size)%}&lt;/span&gt;&lt;/td&gt; &lt;td class="error" colspan="2"&gt;&lt;span class="label label-important"&gt;{%=locale.fileupload.error%}&lt;/span&gt; {%=locale.fileupload.errors[file.error] || file.error%}&lt;/td&gt; {% } else { %} &lt;td class="preview"&gt;{% if (file.thumbnail_url) { %} &lt;a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}"&gt;&lt;img src="{%=file.thumbnail_url%}"&gt;&lt;/a&gt; {% } %}&lt;/td&gt; &lt;td class="name"&gt; &lt;a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&amp;&amp;'gallery'%}" download="{%=file.name%}"&gt;{%=file.name%}&lt;/a&gt; &lt;/td&gt; &lt;td class="size"&gt;&lt;span&gt;{%=o.formatFileSize(file.size)%}&lt;/span&gt;&lt;/td&gt; &lt;td colspan="2"&gt;&lt;/td&gt; {% } %} &lt;td class="delete"&gt; &lt;button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}"&gt; &lt;i class="icon-trash icon-white"&gt;&lt;/i&gt; &lt;span&gt;{%=locale.fileupload.destroy%}&lt;/span&gt; &lt;/button&gt; &lt;input type="checkbox" name="delete" value="1"&gt; &lt;/td&gt; &lt;/tr&gt; {% } %} &lt;/script&gt; </code></pre> <ul> <li>So, what type is <code>text/x-tmpl</code>?</li> <li>What are these <code>{%</code> and <code>%}</code> tags?</li> <li>What parser executes this code?</li> <li>...</li> </ul> <p>...but would like to know everything about this.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload