global vars in a php block

From: Date: Tue, 16 Dec 2003 17:22:55 +0000
Subject: global vars in a php block
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10702@lists.php.net to get a copy of this message
Hi, my question is stupid but I would like to know the best way to solve it. Having a index.php like this: $MYVAR = "test"; $smarty = new Smarty; $smarty->display('index.tpl'); Having a index.tpl like this: {php} echo "Printing from php<br>"; echo "\$MYVAR: $MYVAR"; {/php} I would like to obtain: Printing from php $MYVAR: test Unluckly $MYVAR is not reachable from the php block. I solved it using {php} extract($GLOBALS); echo "Printing from php<br>"; echo "\$MYVAR: $MYVAR"; {/php} but I don't like this solution. Is there any better way? Thank you in advance, Luca

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