For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > April 2005 > Problem with assign_by_ref









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem with assign_by_ref
Jean-Sébastien Guay

2005-04-29, 9:00 pm

Hello,

I'm relatively new to Smarty, and I'm having trouble with assign_by_ref.
Here's the situation.

I'm passing a hash to a member function that looks like this :
public function presentResult( $result ) {
foreach ( $result as $key => $value ) {
self::$smarty->assign_by_ref( $key, $value );
}

self::$smarty->display( 'index.tpl' );
}

I was using assign() before, instead of assign_by_ref(), and it worked
fine. But now I want to pass objects to Smarty as well as simple
scalars, so I changed it to assign_by_ref() for all variables (since I
don't modify any variables in templates, it doesn't really matter). Now,
it seems as if none of my variables are making it to Smarty... If I look
at the debug pop-up, all the variables show up as empty...

Am I doing something wrong? I assume something like this should work...

Thanks in advance,

J-S

--
________________________________________
___
Jean-Sébastien Guay jean_seb@videotron.ca
http://whitestar02.webhop.org/



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.0 - Release Date: 2005/04/29
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com