problem printing an array in a loop
Philippe Le Gal <[email protected]> Wed, 26 Mar 2008 00:39:50 +0100
| Newsgroups | gmane.text.clearsilver.general |
|---|---|
| Message-ID | <[email protected]> |
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 ?>
But it doesn't work....
Any idea ?
Philippe