Re: [htmltmpl] Request for more contextual data to filters and coderef vars
Brought to you by:
samtregar
From: Sam T. <sa...@tr...> - 2006-02-27 19:29:29
|
On Sat, 25 Feb 2006, Brad Choate wrote: > Hi all-- brand new to the list, but I've been using HTML::Template for > some time. Just to quickly introduce myself... I work at Six Apart as > one of the engineers of Movable Type. MT uses HTML::Template for all > of its application UI. Hey Brad, good to meet you. I believe I owe my mention in the book "We Blog" to Six Apart. I'll let you decide if that's a good thing or not. > First, for filters: a filter should be able to determine what file is > currently being processed, if the contents of the template did come > from a file. I guess that makes sense. I'm curious though - what are you planning to do with this feature? > Second, for template vars that are coderefs. > > To me, these are a bit limited since the coderef has no way to > determine it's context. I'm envisioning a scenario like this: > > <TMPL_LOOP NAME=X> > <TMPL_VAR NAME=CODE_FOO> > </TMPL_LOOP> > > The coderef associated with 'code_foo' is called for each iteration of > the array in parameter 'x', but 'code_foo' has no way to access the > active row of data. This seems less obviously useful to me. If the data-structure for loop X is so complicated then why make it more complicated by using code-refs? Why not just bake it all into the structure you pass to param() in the first place? I should admit, I very rarely use code-ref params in my work. They seem to have a very limited utility. I used them to implement HTML::Template::Expr, but I wouldn't say I'm proud of that fact! -sam |