[erlang-questions] erlydtl and the template module

Zoltan Lajos Kis kiszl@REDACTED
Wed Oct 28 20:17:39 CET 2009


Hi Pablo,

Yes, welcome_template is a module. The call to compile creates a proper 
Erlang module from your template store.
You can use it just as you would use any other module. It will be 
available as long as the Erlang VM is running.
If you want it to persist, you can pass the outdir option to the compile 
call, and the module will also be saved as a .beam file.
See http://code.google.com/p/erlydtl/wiki/Overview for details.

Regards,
Zoltan.



Pablo Platt wrote:
> Hi,
>
> I'm using erlydtl to compile templates for a website 
> http://code.google.com/p/erlydtl/
>
> The example on the first page shows how to compile a module:
> erlydtl:compile("/path/to/welcome.html", welcome_template),
> welcome_template:render([
>    {name, "Johnny"},
>    {friends, [<<"Frankie Lee">>, <<"Judas Priest">>]},
>    {primes, [1, 2, "3", <<"5">>]}
> ]).
>
> Is welcome_template a module?
> How long does it exists? until the process that called it terminates?
>
> If I have two processes handling two different requests at the same time 
> will each process recreate the welcome_template ?
>
> Can I use the atom welcome_template for two different templates with two processes at the same time?
>
> Thanks
>
>
>
>       
>   



More information about the erlang-questions mailing list