in reply to Re: Survey of Surveys on HTML Templating systems
in thread Survey of Surveys on HTML Templating systems
Everything you said about Petal applies to Seamstress. However, the
advantage of Seamstress is that you don't need to learn a
mini-language.
So let's take the same content:
And when you look at this in dreamweaver or a browser you'll seeWelcome back <b tal:content="user/name">Sample Username</b>, you last logged in <i tal:content="user/last_login">Sat 23rd Aug</i>
Welcome back Sample Username, you last logged in Sat 23rd Aug
And assuming
$h = { user => { name => "Fergal Daly" last_login => "Feb 22nd" } }
The processed output will be
Welcome back Fergal Daly, you last logged in Feb 22nd
Now for the big difference
Of course TAL handles loops and conditionals etc.Seamstress does not. Perl has loops and conditionals and sees no need for their re-invention.
The thing that takes the most getting used to is that it's a little verbose. Unfortunately this is a necessary side effect of being truly compatible with XML/HTML.I agree with you here, but I personally could have it no other way either. Here is how seamstress would template the same thing:
require html::welcome_form; my $tree = html::welcome_form->new; my $user_name = $tree->look_down('tal:content' => 'user/name'); $user_name->replace_content($hash->{user}{name}); my $last_login = $tree->look_down('tal:content' => 'user/last_login); $last_login->replace_content($hash->{user}{last_login});
or with a loop
for my $content (qw(name last_login)) { $tree->look_down('tal:content' => $content) ->replace_content($hash->{user}{$content}); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Survey of Surveys on HTML Templating systems
by fergal (Chaplain) on Feb 23, 2005 at 22:34 UTC | |
by metaperl (Curate) on Feb 23, 2005 at 22:51 UTC | |
by fergal (Chaplain) on Feb 24, 2005 at 01:42 UTC | |
by metaperl (Curate) on Feb 24, 2005 at 20:14 UTC | |
by fergal (Chaplain) on Feb 26, 2005 at 03:10 UTC | |
|
In Section
Meditations