Tim Colson (tcolson) wrote:
> Howdy folks -
>   My actions populate a template with params, that template is rendered.
> And then, I want to wrap the results inside another "layout" template.
> 
> 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.

> Also wondering -- can the gooey center set param values that I could
> then use in the outer layout template? (Ex. center somehow sets a param
> "page-title" to "<B><TMPL_VAR name=username></B>")

If you use Template Toolkit this is very easy (and actually one of my
complaints about H::T, sorry Sam :).

For instance, if you have a <title><tmpl_var title></title> section in
your header template, you have to set that in every run mode. It's
purely a display issue and I would like to be able to set it from inside
the template.

With TT you can do it in a couple of ways. I like WRAPPER myself. You
create a wrapper template which just has a [% content %] var. And then
in your gooey center template can set the title.

So something like this:

wrapper.tmpl

<html>
  <head><title>[% page_title %]</title></head>
  <body>[% content %]></body>
</html>

gooey.tmpl

[% SET page_title = 'Gooey Center' %]
...


Your perl code:

my $template = Template->new(
  WRAPPER      => 'wrapper.tmpl',
  ...
);

-- 
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