Tim Colson (tcolson) wrote:
> Hey Michael -
> 
> 
>>>I'm wondering if the internal (gooey center) template can somehow be
>>>reused? (i.e. I may want all the same params set, but just use a
>>>different template file)
>>
>>I think in most templating systems you just have to make this decision
>>in your perl. Just load a different template.
> 
> 
> Sorry -- I wasn't clear there. The Gooey Center Template holds a bunch
> of params, ex $tmpl->param(USER=>$username). I'd like to wrap that
> template -and- have those "inside" params available to the wrapper --
> without having to re-set them all. So the outside wrapper could re-use
> them. In the java world, I use Velocity and the idea there is that you
> have:

Oh, sorry. I didn't understand what you originally were asking for. Yes,
with TT, using WRAPPER the variables meant for the inside template are
available for the outside as well.

> Context + Template => output 
> 
> And they have the idea of "chained" contexts...meaning that one part of
> the code can stick stuff (i.e. params) into the context, and then
> another bit of code can grab the context and add more stuff (i.e. more
> params). 
> 
> But in the cgiapp_postrun method, all the params set by the action are
> essentially lost, eh? :-(
> 
>  
> 
>>If you use Template Toolkit this is very easy 
> 
> Thanks for the example! That is what I'm looking for, so it may force me
> to dig into TT. 
> 
> I had hoped to stay with H:T because I really don't like having all the
> other bells available to the template. And because, well, HT is easy and
> I'm lazy. <grin>

That's actually why I stayed away from TT for a while too. All the
examples show doing what is, IMO, a bad idea for templates: doing DB
queries, etc.

I basically confine myself to the features of TT that H::T has except
for the following:
 + WRAPPER
 + Boolean logic (OR and AND)
 + Using object methods (almost always accessor methods, ala
Class::DBI), and direct access to hashes. This is especially helpful to
keep things like date formatting within the template.

And sometimes I like the following, although it's not strictly necessary:
 + Including templates with arguments. This is especially helpful for
recursive templates (eg, a threaded discussion) where you can pass the
root node to a template much like you would for a recursive function.

-- 
Michael Peters
Developer
Plus Three, LP


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to