I've run into this a few times:  I have a list of "things" (usually colors
or images) that I want to cycle through in a loop.

I also want to keep the template as simple as possible for the designers
(which often means I set up the framework and they can tell which parts
not to mess with)

If I have this:

[% Images = ['1.gif','2.gif','3.gif'] %]
[% FOREACH foo = bar() %]
  #Do something here
  [% I want an image here %]
[% END %]

My "instictive" reaction is to try:

[% Images.$loop.index %]

which doesn't work.

This seems to greatly reduce the usefulness of the loop variables.

Of course, I can get around this by:

[% Temp = loop.index %]
[% Images.$Temp %]

But that's hardly as pretty.

Ideas?




Reply via email to