> If I have a template:
> [% BLOCK atemplate %]
> [% IF mystuff %]
> [% FOREACH stuff = mystuff %]
> [% content %]
> [% END %]
> [% END %]
> [% END %]
>
> and I use it from
> [% ahash = { name => 'bla' } %]
> [% WRAPPER atemplate
> mystuff = [ ahash ]
> %]
> [% Dumper.dump($stuff) %]
> [% $stuff.name %]
> [% END %]
>
> how come I can't access stuff (and mystuff) from within the content?
> (or can I but I've done it wrong...)
WRAPPER doesn't do what you are trying to do. WRAPPER first
processes the enclosed block to generate some output, which is
available as "content" inside the wrapper. So once you get
inside your atemplate block, content is just flat text. It
doesn't get reprocessed.
One solution is to put your content into a block, eg, foo, and then use
PROCESS inside atemplate to process it. Rather than use WRAPPER you can
just use PROCESS; foo can be passed in as as variable or hardcoded as
necessary:
[% USE Dumper %]
[% BLOCK foo %]
[% Dumper.dump(stuff) %]
[% stuff.name %]
[% END %]
[% BLOCK atemplate %]
[% FOREACH stuff = mystuff %]
[% PROCESS $inside %]
[% END %]
[% END %]
[% ahash = [ { name => 'bla'}, {name => 'blah'} ] %]
[% PROCESS atemplate mystuff = ahash inside="foo" %]
Craig