Re: mixing of asign() and assign_by_ref() overwrites
Sebastian Mendel <[email protected]>
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <[email protected]> |
Sebastian Mendel schrieb:
> Boots schrieb:
>
>> [...]
>> It doesn't solve the problem: the original poster was mis-using the
>> feature.
>
>
> :-(
>
> i dont think so!
>
> is use it in this way:
> PHP 4.3.6
>
> main()
>
> $smarty = new Smarty;
> // user - object allways, cause its allways needed!
> $_SESSION['user'] = new User;
> $smarty->assign_by_ref('user', $_SESSION['user']);
> // and many other data added to $smarty
> ...
>
>
> // later i need an template for mail, with the same data
> $mail = $smarty
>
> // except the user-data
> $mail->assign('user', $user_data_array);
> mail($mail->fetch....);
> ...
>
> // end of page, display
> $smarty->display('page.tpl');
>
> page.tpl:
> ... {$smarty.customer->getID()} ...
>
> Raises: Fatal error: Call to a member function on a non-object in ...
>
>
> i have shortened this, i hope i dont forgot relevant things ..
>
if forgot the example:
$myvar = true;
var_dump($myvar);
echo '<br />';
$test = new Smarty;
$test->assign_by_ref('myvar', $myvar);
$test_2 = $test;
$test_2->assign('myvar', false);
var_dump($myvar);
echo '<br />';
--
Sebastian Mendel
www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com
www.sf.net/projects/phpdatetime www.sf.net/projects/phptimesheet
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php