You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi dudes,
Before exposing my problem, I want to give what you deserve to: Thanks for this awesome work!
My "issue" here is that i would like to not use Diet templates. I imported mustache-d successfully, but now I don't know how I can use the result of Mustache.render and display it on my page. It seems that HTTPServerResponse.writeBody() would do the job but i don't understand how I can get a copy of the res object while being inside a WebInterface.
Here's my current code:
classWebInterface {
private voidrenderTemplate(string file, Mustache.Context ctx)(HTTPServerResponse res) {
Mustache mustache;
mustache.path = "../views/";
auto html = mustache.render(file, ctx);
res.writeBody(html, 200, "text/html, charset=UTF-8");
}
@method(HTTPMethod.GET) @path("/")
voidindex() {
auto context = new Mustache.Context;
res.renderTemplate("index", context);
}
}
With #1938 (for issue #1937), you can access the global response object. That would allow you to write a render function similar to the one in vibe.web.web.
Hi dudes,
Before exposing my problem, I want to give what you deserve to: Thanks for this awesome work!
My "issue" here is that i would like to not use Diet templates. I imported
mustache-d
successfully, but now I don't know how I can use the result ofMustache.render
and display it on my page. It seems thatHTTPServerResponse.writeBody()
would do the job but i don't understand how I can get a copy of theres
object while being inside aWebInterface
.Here's my current code:
So, the error dmd is telling me is:
Thanks for the future replies ;)
The text was updated successfully, but these errors were encountered: