You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Gunther Birznieks <gu...@extropia.com> on 2002/06/08 02:51:48 UTC
Re: [Templates] Re: Separating Aspects (Re: separating C from
V in MVC)
At 04:14 PM 6/7/2002, Tony Bowden wrote:
>On Thu, Jun 06, 2002 at 05:08:56PM -0400, Sam Tregar wrote:
> > > Suppose you have a model object for a concert which includes a date. On
> > > one page, the designers want to dipslay the date in a verbose way with
> > > the month spelled out, but on another they want it abbreviated and fixed
> > > length so that dates line up nicely. Would you put that formatting in
> > > the controller?
> > In the script:
> >
> > $template->param(long_date => $long_date,
> > short_date => $short_date);
> > In the template:
> >
> > The long date: <tmpl_var long_date> <br>
> > The short date: <tmpl_var short_date>
>
>Can I vote for "yick" on this?
>
>A designer should never have to come to a programmer just to change the
>formatting of a date.
>
>I'm a huge fan of passing Date::Simple objects, which can then take a
>strftime format string:
>
> [% date.format("%d %b %y") %]
> [% date.format("%Y-%m-%d") %]
And the latter does not require a programmer?
Re: [Templates] Re: Separating Aspects (Re: separating C from V in MVC)
Posted by Tony Bowden <to...@kasei.com>.
On Sat, Jun 08, 2002 at 08:51:48AM +0800, Gunther Birznieks wrote:
> >I'm a huge fan of passing Date::Simple objects, which can then take a
> >strftime format string:
> > [% date.format("%d %b %y") %]
> > [% date.format("%Y-%m-%d") %]
> And the latter does not require a programmer?
Of course not. It just requires someone who can read a simple chart of
strftime formats. I've never worked with a designer who hasn't been able
to understand the DESCRIPTION section of, for example,
http://unixhelp.ed.ac.uk/CGI/man-cgi?strftime+3
It wouldn't be difficult to make up a more "designer friendly" version
of it if it was really needed.
Tony