Re: [SMARTY] $global_assign
| From: | Piotr Klaban | Date: | Thu, 14 Nov 2002 07:28:47 +0000 |
| Subject: | Re: [SMARTY] $global_assign | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6426@lists.php.net to get a copy of this message | ||
On Wed, Nov 13, 2002 at 10:18:16AM -0500, Gerard Samuel wrote:
> Im trying to figure out how to use this variable.
> In my php script I have ->
> $mpn_tpl->global_assign = array('my_global' => array('what' =>
> 'abc',
> 'not' => 'xyz'));
IMHO in Smarty 2.3.0 Smarty::global_assign should be assigned
before object construction. Then you can only manually edit
Smarty.class.php and change:
<tochange>
var $global_assign = array( 'HTTP_SERVER_VARS' => array( 'SCRIPT_NAME'
)
); // variables from the GLOBALS array
// that are implicitly assigned
// to all templates
</change>
to
var $global_assign = array('HTTP_SERVER_VARS' => array('SCRIPT_NAME'),
'my_global' => array('what','not'));
Then in your_script.php write:
global $my_global;
$my_global = array('what' => 'abc', 'not' =>
'xyz'));
> In the template, Im trying ->
> {$smarty.my_global.what}
This is not correct then. my_global is now the global variable to
templates. I.e. you just use: {$my_global.what} / {$my_global.not}
It is easier to just assign ordinary variable.
Best regards,
--
Piotr Klaban