[ic] loop-code

Stefan Hornburg Racke interchange-users@interchange.redhat.com
Tue Aug 14 16:21:01 2001


"Tim Mirecki" <tim@q5.ca> writes:

> Here's what I am REALLY trying to do...I was attempting to simplify it.
> 
> [loop arg="1 2 3"]
>      [data base="table" column="price" code="[item-param [loop-code]]"]
> [/loop]
> 
> Which will first produce:
> 
>      [data base="table" column="price" code="[item-param 1]"]
>      [data base="table" column="price" code="[item-param 2]"]
>      [data base="table" column="price" code="[item-param 3]"]
> 
> I want it to get the values for [item-param 1], [item-param 2], etc...
> 
> However, it seems to be getting stuck at [item-param 1] and returning that,
> without looking up the value for item-param 1. Because of that, it's
> actually looking up the code "[item-param 1]" which doesn't exist.

You can't do that because in a item list, the [item-] stuff
is evaluated before anything else, so this renders your example
useless.

But why not

[calc]
my $out;
for ('[item-param foo]', '[item-param bar]') {
    $out .= $Tag->data('table','price',$_);
} 
$out;
[/calc]

Ciao
        Racke

-- 
Racke happily hacks Interchange and maintains Debian packages like Courier.

For projects and other business stuff please refer to COBOLT NetServices
(URL: http://www.cobolt.net; Email: info@cobolt.net; Phone: 0041-1-3884400)