[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-windows
Subject:    Re[2]: [PHP-WIN] Need help with variables
From:       Ruslan Ohitin <rus () bagan ! ru>
Date:       2001-06-27 3:26:31
[Download RAW message or body]

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 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 afraid that this suggestion didn't help me.
ML> or am i missing something?

ML> With the example above i get the (string) value of variable $var to be "DAYn" -
ML> And not the variable name, which is what i want.
But this is what Template::set_var() wants! PHP knows nothing about
template variables. Assigning value to $DAY1 will not lead to change
template var {DAY1} to this value.

ML> In theory what i want to achieve is this:
ML> $DAY1="Monday";
ML> $DAY2="Next day";
ML> $DAY4="Some other day";
ML> ....
ML> ....

ML> I have 54 Template variables named "DAYn".
ML> I want to (in a for loop - 'cause there are 54 of them!) transfer all string
ML> values from my $day[n] array to the Template variables namned "DAYn".
ML> The array $day[n] is then supposed to hold the required strings.
ML> $day[1]="Monday";
ML> $day[2]="Next day";
ML> $day[3]="Some other day";
ML> ...
ML> ...


ML> --

ML> Michel Laine



-- 
Best regards,
 Ruslan
 mailto:rus@bagan.ru


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
For additional commands, e-mail: php-windows-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic