[Templates] setting META data in process()

[prev] [thread] [next] [Date index for 2005/01/08]

From: Bill Moseley
Subject: [Templates] setting META data in process()
Date: 20:41 on 08 Jan 2005
I use [% META %] blocks to define some template metadata.  Then in a
wrapper I'm using [% template.foo %] to get at that data.

I'm processing some input files that don't have the [% META %] set,
but I know the values to set when I call $template->process().

Is there a way to get the template meta data set when calling process?

Or do I need to pass in a separate "mytemplate" hash?

my $vars = {
    mytemplate => {
        foo => $bar,
    },
};
$template->process( $page, $vars ) || die;

and then in my templates do:

   [% foo = mytemplate.foo || template.foo %]


        -- 
        Bill Moseley
moseley@xxxx.xxx


_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] setting META data in process()
Bill Moseley 20:41 on 08 Jan 2005

Re: [Templates] setting META data in process()
Andy Wardley 09:40 on 09 Jan 2005

[Templates] Slashdot Templating article
Leo Lapworth 10:33 on 09 Jan 2005

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52