Hi, this has been bugging me for a bit so I decided to waste some time
on it and see what I could come up with.
The basic premise is that you pass the template a variable such as:
VARIABLES = {
'C.I.A' => ['American', 'Dirty'],
'MI6' => ['British', '007'],
'F.S.B' => ['Russian', 'K.G.B.'] }
I believe that this is illegal variable naming, at least based upon
reading Template Toolkit::Manual::Variables.
So of course you *might* expect it to work like this:
[% FOREACH secret = ['C.I.A' 'MI6', 'F.S.B.'] %]
[% FOREACH keyword = $secret %]
[% keyword %]
[% END %]
[% END %]
But it doesn't.
However what's REALLY STRANGE is how you *can* make this work, which is
like this:
[% FOREACH secret = ['C.I.A' 'MI6', 'F.S.B.'] %]
[% FOREACH position = [0 .. $secret.max] %]
[% $secret.$position %]
[% END %]
[% END %]
Which means that in the above context the variables with a period or dot
can be accessed but in the previous context they can't.
Just thought this might be helpful for anyone who had the same problem I
had, and might also be interesting to know why it's like this.
Tosh
--
McIntosh Cooey - Twelve Hundred Group LLC - http://www.1200group.com/
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates