[Templates] Last-modified date

Andy Wardley abw@cre.canon.co.uk
Thu, 3 Aug 2000 12:23:29 +0100


On Aug 2, 10:38am, Rafael Kitover wrote:
> [% PERL %]
> use HTTP::Date;
> $stash->{mod_time} = time2str(time);
> [% END %]
>
> in the top level template, then just
>
> Last modified: [% mod_time %]

There's a Date plugin which will be included in version 2.00 and also
the interim version 1.08 which should hopefully be out early next week.
Usage is something like this:

    [% USE Date %]
    [% Date.format %]          # use current time and default format
    [% Date.format(mytime) %]  # use specific time
    [% Date.format(mytime, '%d-%b-%y') %] # new format as per strftime()

Version 2 defines a 'template' data structure which contains meta-information
about the main template you're processing.  It doesn't yet support a
'modtime' variable, but you can be sure it will by the next beta!  :-)=

That will allow you to do this:

    [% USE Date %]
    Last modified: [% date.format(template.modtime) %]

I've got a copy of the date plugin right here on my laptop, but it's
thrashing around in it's final death throes (disk full, network broken,
all sorts of horrible problems) so I can't get at it to give it to you.
I'll dig it out when I get home later and post it here.  Until then,
you might like to extract the source from this mail message.  You can
install it in the Template/Plugins directory and it should get picked
up OK.

http://www.template-toolkit.org/pipermail/templates/2000-June/000006.html


Cheers
A

-- 
Andy Wardley <abw@kfs.org>   Signature regenerating.  Please remain seated.
     <abw@cre.canon.co.uk>   For a good time: http://www.kfs.org/~abw/