i have next question. I have this code for loading my templates:
$.Mustache.load( "./templates/news/home.tpl" );
Which is:
function load(url, onComplete)
{
return $.ajax({
url: url,
dataType: options.externalTemplateDataType
}).done(function (templates)
{
$(templates).filter('script').each(function (i, el)
{
add(el.id, $(el).html());
});
if ($.isFunction(onComplete)) {
onComplete();
}
});
}
And when i make a click, to get to the other page:
$("body").append($.Mustache.render(pageId + "-template", data));
Which is:
function render(templateName, templateData) {
alert(!has(templateName));
if (!has(templateName)) {
if (options.warnOnMissingTemplates) {
$.error('No template registered for: ' + templateName);
}
return '';
}
return getMustache().to_html(templateMap[templateName], templateData, templateMap);
}
So my it falls at : if (!has(templateName)) because sais that template is not loaded, what is the problem?
Templates weren't loading because i have to set full path - www/templates/news/home.tpl Sometimes there is a lag, and WP doesn't load templates with *.tpl format, so i changed it to txt and all worked