Markus Deiml said:
> if I understand it right you can't use a <for> tag inside a content item.
> For example
> <content name="main">
> <for name="x" values="1 2 3">
> ${content_${x}}
> </for>
> </content>
> wouldn't expand to
> <content name="main">
> ${content_1}
> ${content_2}
> ${content_3}
> </content>
> Does anyone know how I can get a "for loop" or something similar inside a
> content item? Perhaps using perl code?
Hi Markus --
I'd been vaguely thinking of doing this a while ago, but never got around
to it. WebMake has separate sets of tags for the .wmk file, and for
inside content items -- and <for> is only defined in the former set of
tags.
However, defining a plugin to do it, using the "define_tag()" API would
be *very* easy, and I'd be happy to include it in the distribution ;)
I would suggest using a different name for the tag instead of <for>, just
to avoid confusion with the .wmk-file tag <for>. <multiple> is used by
the ACS Templating System [1] -- or <foreach>, or whatever...
[1]: http://www.wgbh.org/doc/acs-templating/tagref/
PS: but in the short term you may be happier with this:
<content name=repeated_item>......</content>
<content name="main">
<{perlout
foreach my $x (1, 2, 3) {
print get_content ("content_$x");
}
}>
</content>
;)
--j.