22 March 2006

current year (e.g., for copyright) in TT2 templates

If you are using the Perl Template Toolkit and want the template always to display a copyright notice giving the current year, just include the following in your template:

© [% USE date %][% date.format(date.now, '%Y') %]

It uses the Template::Plugin::Date plugin.

1 comment:

mbrisby said...

you can do the same thing in Smarty (PHP) templates with the following code:

©{$smarty.now|date_format:"%Y"}