[Templates] Global matching

Mark Fowler mark@twoshortplanks.com
Thu, 5 Sep 2002 10:30:30 +0100 (BST)


On Wed, 4 Sep 2002, Perrin Harkins wrote:

> This is a nice summary of how to add Perl functions to TT.  How about 
> packaging this up as a part of the documentation?

I'm currently working flat out on slides for YAPC::E ("Extending the
Template Toolkit.")  I'll upload those, and then turn them into more of a
written tutorial once I'm done.
 
> I don't think that's really a problem.  It costs you nothing to add your 
> own functions to the stash every time.  If I were using plugins, I would 
> probably be adding them in ahead of time as well.

Okay, maybe this section needs rewording.  It's the whole division of 
responsibility thing.  My apache handler takes the input data and 
processes it in such a way that it creates a presentation agnostic data 
set.  My handler (in theory at least) shouldn't care about how the output 
is rendered - that's the template's job.  Essentially if I find I need the 
ability to count occurrences in the template then it's not really the 
handlers problem - the template should worry about it and load plugins for 
itself.

(*sound effect* - Mark updating slides)

Mark

-- 
s''  Mark Fowler                                     London.pm   Bath.pm
     http://www.twoshortplanks.com/              mark@twoshortplanks.com
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/  +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}