Re: [SMARTY] again.. $global_assign

From: Date: Tue, 04 Jun 2002 18:09:33 +0000
Subject: Re: [SMARTY] again.. $global_assign
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4581@lists.php.net to get a copy of this message
$global_assign is used to implicitly assign PHP global variables to the templates. So for instance, if you assign SCRIPT_NAME, then whatever is in $GLOBALS['SCRIPT_NAME'] would always be available in the templates so you could do something like this: <form action="{$SCRIPT_NAME}">...</form> <a href="{$SCRIPT_NAME}?action=foo">blah</a> without the need to do this _every_ time you display a template: $smarty->assign('SCRIPT_NAME',$GLOBALS['SCRIPT_NAME']); With the introduction of the $smarty variable (came way later than $global_assign), there are other ways to access some of the global variables, like so: {$smarty.env.SCRIPT_NAME} So here global_assign isn't really needed, except {$SCRIPT_NAME} is cleaner to use than {$smarty.env.SCRIPT_NAME} Monte Blue Presley wrote:
I'm glad that my questions and comments have aroused positive discussion about aspects of smarty.. HOWEVER.. could someone PLEASE answer my question? $global_assign.. what is it? what does it do? how does it work? could someone give an example? Is $global_assign used to pass assigned template values from one page to another? if so, how do i access it? right now i'm having to reassign my variables on each page and it's a pain in the ass. thanks, blue
-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

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