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?
模板未加载,因为我必须设置完整路径-www / templates / news / home.tpl有时会出现滞后,并且WP无法加载* .tpl格式的模板,因此我将其更改为txt,并且一切正常
Why don't You use *.html extension? And editors will recognize it as HTML syntax too. :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.