javascript - $.Mustache.load and $.Mustache.render -
i have next question. have code loading 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 make click, 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 falls @ : if (!has(templatename)) because sais template not loaded, problem?
templates weren't loading because have set full path - www/templates/news/home.tpl there lag, , wp doesn't load templates *.tpl format, changed txt , worked
Comments
Post a Comment