This is the code snippet from my original message:
>
> // Do it!
> for ($i = 0; $i <= 34; $i++) {
>
> // Need help with this part
> $j = $i + 1;
> $var = ${"DAY".$j};
> $val = $day[$i];
>
> // Set PHPLIB Template variable
> $t->set_var( $var => $val );
>
> }
>
> // D
Hello Michel,
I send you example that works with PHPLib template. This is a method I
use in my scripts.
Hope it helps you.
ML> Ruslan Ohitin wrote:
>> Hello Michel,
>>
>> You mixing php variables and Template variables. They are from
>> different "namespaces". set_var() takes associative array
Ruslan Ohitin wrote:
> Hello Michel,
>
> You mixing php variables and Template variables. They are from
> different "namespaces". set_var() takes associative array with string
> keys - Template var names. Edit one line of your code:
>
> ML> $var = ${"DAY".$j};
> $var = "DAY" . $j; // $var is
Hello Michel,
You mixing php variables and Template variables. They are from
different "namespaces". set_var() takes associative array with string
keys - Template var names. Edit one line of your code:
ML> $var = ${"DAY".$j};
$var = "DAY" . $j; // $var is a string "DAYn"
--
Best regards,
I am trying to assign a bunch of strings to some Template variables
where:
I have an array $day[n] where n is 0-34 and contain strings.
I have Template variables named "DAYn", where n is a number 1-35.
The template parsing is up and running, so i have left that part out.
// Do it!
for ($i