var page = {
pageCount : 3,
pageNum : [
//loop script to create '"num" : "x"'
]
};
var pageTemplate = '{{#pageNum}} <div id="page{{num}}" class="pages"> page {{num}} </div> {{/pageNum}}';
var pageHtml = Mustache.to_html(pageTemplate, page);
Is it possible to create a for loop or some sort to create num variables in accordance to pageCount like this:
for (var x = 0; x <= pageCount; x++)
It produces a syntax error so I want to know if there are other alternatives to do this. Thanks
From the fine manual:
So all you need to do is put the numbers in
pageNum:And then use
{{.}}to access them in the template: