Cees Hek wrote:
On 3/30/06, fayland <[EMAIL PROTECTED]> wrote:
Cees Hek wrote:
On 3/30/06, fayland <[EMAIL PROTECTED]> wrote:

It's a normal question. we have a wrapper.html contains:
<title>[% title || c.config.name %]</title>
how to set this "title"? I use [% META title = , but META cann't be a
var like forum.name.
my problem is how can I set this "title" as forum.name. ( I tried set
$c->stash->{title} = $forum->name , it doesn't help)

I usually just set the title right in the template that is being wrapped.

[% WRAPPER wrapper.html title=forum.name %]

[% END %]

We use Catalyst to build our site, so it seems unadoptable. O:-)

I don't use Catalyst, so I can't help you there.

But you should also just be able to set that value as a normal variable:

[% SET title = forum.name %]

it cann't work since the WARPPER is work first than other tt files I think.

Did you try it?

test.tmpl
------------------------
[% title1 || 'No Title 1' %]
[% title2 || 'No Title 2' %]
------------------------


test.pl
------------------------
use Template;

my $template = Template->new(
    WRAPPER => 'test.tmpl',
);
$template->process(\*DATA, { title1 => 'Title 1' }) or die $template->error;
__DATA__
[% SET title2 = 'Title 2' -%]
------------------------

Run that and it prints this:

Title 1
Title 2

One title is set in the code, and the other in the template, and both
variables are accessible from the wrapper template.

Cheers,

Cees

sorry, my mistake. it totally works. thanks very much.

--
Fayland Lam // http://www.fayland.org/

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to