On Fri, Oct 26, 2001 at 05:50:23PM +0200, Joerg, Harald wrote:
> How can a filter set global template variables? Are there other
> parameters to the filter routine than just the text which is about
> to be filtered?
>
> I'd guess this needs a dynamic filter
Yes, that's right. The dynamic filter gets a reference to the context
and you can $context->stash->set('global.submenu', $data).
> which is difficult (if at all
> possible?!) to create with "plain" ttree - or what am I missing?
You could do it using a plugin. You can set plugin_path in the ttree
config file and of course, the plugin constructor gets a reference to
the context which you can then use as above. I normally find that if
I'm doing anything even moderately complex for a particular site, I'll
always create at least one site-specific plugin in which I can put all
the the Perly code things that I don't want in templates.
Alternately, if you've got EVAL_PERL enabled, you could do something
like this in the pre-processed config file:
[% PERL %]
$context->define_filter(
submenu_filter => sub {
...
}
)
[% END %]
Cheers
A