Closed daslicht closed 8 years ago
Ok I found a solution myself:
app.get('/', function (req, res) {
var tmpl = jsrender.templates("./app/home/index.html")
var html = tmpl.render();
var context = { hello: "world", template: html};
res.render('app/layout', context, function(err, html) {
res.send(err ? jsrender.views.converters.html(err.message) : html); // HTML encode message
});
});
I am the Layout, next line is an include: <br>
<hr>
<!-- {{include tmpl='./app/home/index.html' /}} <br> -->
{{:hello}}
{{>template}} <br>
<hr>
{{include tmpl='./app/_include/footer.html' /}}
Are there any downsides of this solution ?
is there a way to include a template with context ?
tmpl=anyExpression
- it does not have to be the statically-defined name or selector string...
http://www.jsviews.com/#samples/jsr/composition/tmpl-objects
Thank you !
Hi, is there a way to solve something like this :
Or is there a template extend ?
Are custom tags meant for this usage ?