stl and yaws

Mickael Remond mickael.remond@REDACTED
Tue Jan 14 09:16:13 CET 2003


* Mikael Karlsson <mikael.karlsson@REDACTED> [2003-01-13 23:31:19 +0100]:

> I recalled that Mickael Remond mentioned the public contribution
> STL (Simple Template Language) 
> - http://www.erlang.org/user.html#stl-1.0 
> by Vladimir Sekissov at his talk EUC2002.
> STL is described as:
> >>
> STL as `Simple Template Language' is a clone of Bruce R. Lewis's BRL 
> (http://brl.sourceforge.net) implemented in Erlang. It deals with template 
> processing and has most capabilities which user expects from web template 
> engines.
> <<
> I looked at it and thought of using it for Yaws, but at first sight I can not 
> see what the gain would be compared to using Yaws own  tags.
> <erl></erl> instead of the (* *) and *) (*  delimiters? 
> 
> Greatful for any explanation. Thanks

In fact, the STL thing allows easy integration of variables (That is to
say insertion of dynamic content) easily in different part of the
template.
In yaws to insert data in the HTML, you have to declare an out/1 function.
Moreover, each insertion of dynamic content implies an erl set of tag,
with a out function declaration. Each erl zone ends up being compiled as
a separate Erlang module.

Finally, with Yaws system, I often end up with one erl zone covering the
all .yaws file. The main out/1 function is then calling other functions
(from the same yaws file or from an Erlang module) to insert HTML
templating element (Header/ Footer).

BRL is not the perfect templating system, but it avoid this problem. I
still think the way to go would be to code a Zope like (ZPT) templating
system, each template ending up compile as one module. ZPT allows to
define the rendering logic in the template (Variables area, iterations)
and refers to core "business application" code for getting the data or
triggering the processing writing as Erlang module.

I hope this is more clear for you, now.

Happy new Erlang year !

-- 
Mickaël Rémond




More information about the erlang-questions mailing list