Re: Need help with variables

From: Date: Tue, 26 Jun 2001 03:15:53 +0000
Subject: Re: Need help with variables
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-8028@lists.php.net to get a copy of this message
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, Ruslan Ohitin mailto:rus@bagan.ru ML> I am trying to assign a bunch of strings to some Template variables ML> where: ML> I have an array $day[n] where n is 0-34 and contain strings. ML> I have Template variables named "DAYn", where n is a number 1-35. ML> The template parsing is up and running, so i have left that part out. ML> // Do it! ML> for ($i = 0; $i <= 34; $i++) { ML> // Need help with this part ML> $j = $i + 1; ML> $var = ${"DAY".$j}; ML> $val = $day[$i]; ML> // Set PHPLIB Template variable ML> $t->set_var( $var => $val ); ML> } ML> // Do the rest (like parse templates) ML> I have tried so many different combinations that i don't remember them ML> all - The one above being the most recent. ML> Not that it worked any better than any of the other ones... ML> I have read Variable variables in the online manual. ML> If that was on the right track - it must mean that i am just too stupid ML> to get it right. ML> Please help! ML> -- ML> Michel Laine

« previous php.windows (#8028) next »