vibed: how to use pure HTML instead of template engine?

Chris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 6 07:23:26 PDT 2015


On Wednesday, 6 May 2015 at 14:21:24 UTC, Chris wrote:
> On Wednesday, 6 May 2015 at 14:07:09 UTC, Suliman wrote:
>> I mean that I know that template can be changes dynamically, 
>> but I thought that 99% of dynamic is javascript code...
>
> Templates are like PHP, JSP, LSP etc. They can do stuff on the 
> server side via embedded D code, load files for example. With 
> JS you cannot do this. I think you should also be able to 
> access variables set in query strings (?email=my at mail.com ...) 
> and process them. But I'm not 100% sure about the latter. The 
> user variables you get like this:
>
> void customHandler(HTTPServerRequest req, HTTPServerResponse 
> res)
> {
>   auto fields = req.query;  // => ["email":"my at mail.com"];
> }
>
> The drawback of templates is that you have to recompile them 
> after each change atm, which is not very dynamic.
>
> Just have a look at http://vibed.org/templates/diet.

Especially this: http://vibed.org/templates/diet#embedded-code


More information about the Digitalmars-d-learn mailing list