On Wed, 23 Mar 2016 11:58:38 GMT, can wrote:
I develop a web application and I need help. How do I pass variable layout.dt file or how can I show version number at layout.dt
Anything that you pass to render!()
will be available in the rendered template, as well as in any template that it includes and the one it derives from. So the following should work:
layout.dt:
html
body
p The version is #{ver}
block main
page.dt:
extends layout
block main
p These are the page contents.
app.d:
void getPage(HTTPServerRequest req, HTTPServerResponse res)
{
string ver = "1.0.0";
res.render!("page.dt", ver);
}