On Mon, 3 Jun 2002, Rob Nagler wrote:

> Date: Mon, 3 Jun 2002 08:09:12 -0600
> From: Rob Nagler <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: separating C from V in MVC
>
> Perrin Harkins writes:
> > You can actually do that pretty comfortably with Template Toolkit.  You
> > could use a filter for example, which might look like this:
> >
> > [% FILTER font('my_first_name_font') %]
> > ... some text, possibly with other template directives in it...
> > [% END %]
>
> One of the reasons Perl is popular is its idioms.  Having to say
> something in three lines is not as idiomatic as one line.  It takes a
> lot of discipline to use it everywhere.  In other words, I don't think
> the above is more comfortable than:
>
>     String(['User.first_name'], 'my_first_name_font');
>
> Note also the accessor for User.first_name in Template Toolkit is
> probably nontrivial.
>
> Rob

Not to see this discussion devolve into Yet Another Template War, but
there's more than one way to do filters in Template Toolkit:

    [% User.first_name | my_filter %]

Add to the handy "pipe" syntax the number of built-in filters (esp.
the "html" and "uri" ones), and you get a large amount of convenience
because you don't have to pre-format your data before passing it to a
template (which seems to more strongly couple to the "C" to the "V").

    It's just my opinion, baby, I may be right or wrong.
        -- Robert Johnson

ky

Reply via email to