AW: [SMARTY] PHP / SMARTY question

From: Date: Fri, 12 Jul 2002 12:28:08 +0000
Subject: AW: [SMARTY] PHP / SMARTY question
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5265@lists.php.net to get a copy of this message
hi imho the first one is 'smarter' ;), because whenever you wanna use function 'x()' in this template for an other smarty-template you'll only have to change the param to invoke the function. e.g.: x($smarty); x($another_smarty); etc. bye mario > -----Ursprungliche Nachricht----- > Von: Sheldon Jones - Admin [mailto:sheldon@hobbydump.com] > Gesendet: Freitag, 12. Juli 2002 02:52 > An: smarty-general@lists.php.net > Betreff: [SMARTY] PHP / SMARTY question > > > Can someone tell me which method is better? > Method A, pass by referance: > > $smarty = new Smarty; > > function x(&$smarty) { > $smarty->assign("x", "some value"); > } > > print x($smarty); > > > > Method B, use globals: > > $smarty = new Smarty; > > function x() { > global $smarty; > $smarty->assign("x", "some value"); > } > > print x(); > > Thanks for your time, > -- > --Sheldon > > ------------------------------------------------------ > Sheldon Jones > Systems Administrator > Lobo Internet Services, Ltd. > > mailto:sheldon@hobbydump.com > > Does Microsoft mean "small and limp"? > What's with the 'Intel Inside' warning label anyway? > ------------------------------------------------------ > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.smarty.general (#5265) next »