Re: [Maypole] .tt extension on templates?

From: Simon Flack (sf at flacks.net)
Date: Thu Sep 16 2004 - 21:28:47 BST


On Thu, 16 Sep 2004 20:58:30 +0100, Simon Flack wrote
> Dave Howorth:
> >
> > > I normally use a file extension on my templates so that vim can
> > > recognize them and use appropriate colouring. I guess the same thing
> > > goes for emacs users. So I'd like to change all the Maypole templates
> > > to use a .tt extension. Apart from renaming the files and
> > > INCLUDE/PROCESS cross-links, I would also need to change the code to
> > > automatically add the extension to the template names computed from
> > > URLs or hardwired into modules.
> > >
> > > Before I go dig around to find a good place, have I missed any issues?
> > > Do other people think this is a good or bad idea?
>
> You can override the template method in your controller class:
>
> sub template {
> my ($r, $template) = @_;
> my $t = $r->_template_accessor($template);
> return $t . '.tt'; # add .tt
> }

BTW, it probably should be:

 sub template {
     my $r = shift;
     my $t = $r->_template_accessor(@_);
     return $t . '.tt'; # add .tt
 }

The former might set the template to undef if you called is as an accessor.

I've not had a chance to test either, but I think the first one will pass set
template to 'undef' when called as an accessor.

--simonflk

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT