Skip to content
A jQuery Plugin for loading external jQote2 templates.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

#jQote2 Template Loader A jQuery Plugin for loading external jQote2 templates.


Using the jQote2 Template Loader plugin is rather straight forward. Simply include jQuery, jQote2and the jquery.jqote2.loader-min.js script on your page.

For this example, assume a file named "example.tpl" exists, which contains the following template definition:

<script type="text/html" id="articles_tpl">
    	<% var article, i, n;
    	   for ( i = 0, n = this.articles.length; i < n; i++ ) {
			     article = this.articles[i]; 
					<h1><%= %></h1>
				<p><%= article.text %></p>
        <% } %>

We can load the "example.tpl" template file described above via $.jqoteload as follows:

$.jqoteload( 'example.tpl', function( templates )
	// create some mock articles...
	var articles = [ { name: 'Article A', text: 'Articles A test...'},
					 { name: 'Article B', text: 'Articles B test...'},
					 { name: 'Article C', text: 'Articles C test...'} ];
    // Render the articles...
    $('#articles').jqoteapp( templates.articles_tpl, { 'articles': articles } );

After "example.tpl" has been loaded, from another context we can access the compiled templates via their template element id. In this example "articles_tpl".

//... within some other context, access the same compiled template
var template = $.jqoteret( 'articles_tpl' );

The above example can be found in the examples directory.


jQote2 needs a CDN, vote for it :).

You can’t perform that action at this time.