Re: problem printing an array in a loop
Eric Brunson <[email protected]> Tue, 25 Mar 2008 17:42:25 -0600
| Newsgroups | gmane.text.clearsilver.general |
|---|---|
| Message-ID | <[email protected]> |
Philippe Le Gal wrote:
> Hi,
>
> I try to generate an array filled in a c cgi like this :
>
> char values[15][4];
> int x;
>
> // populate values
> for (x = 0; x < 15; x++) {
> sprintf(values[x], "%d", map[x]);
> }
>
>
> for (x = 0; x < 15; x++) {
> hdf_set_valuef(cgi->hdf, "Values.%d=%s", x, values[x]);
> }
>
> I can see that the hdf is filled with the values when debugging :
>
> Values.0 = 0
> Values.1 = 255
> Values.2 = 255
> Values.3 = 255
> Values.4 = 255
> Values.5 = 254
> Values.6 = 254
> Values.7 = 253
> Values.8 = 252
> Values.9 = 252
> Values.10 = 251
> Values.11 = 250
> Values.12 = 249
> Values.13 = 248
> Values.14 = 247
>
> But I'm not able to find the right syntax in the cs file....
>
> This syntax is OK :
>
> <?cs var:Values.0?>
> <?cs var:Values.1?>
> <?cs var:Values.2?>
> <?cs var:Values.3?>
> <?cs var:Values.4?>
> <?cs var:Values.5?>
> ....
>
> But I need a loop to make the job. So I tried :
>
> <?cs loop:x=#0,#15 ?><?cs var:Values.x ?><?cs /loop ?>
>
Have you tried:
<?cs for: v in Values ?><?cs var: v ?><?cs /loop ?>
> But it doesn't work....
>
> Any idea ?
>
> Philippe
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>