Variables assigned from PHP
| From: | Carsten | Date: | Tue, 06 May 2003 11:03:26 +0000 |
| Subject: | Variables assigned from PHP | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-9479@lists.php.net to get a copy of this message | ||
Hi Folks!
The Smarty-Documentation says:
Variables that are assigned from PHP are referenced by preceding them with a
dollar sign $. Variables assigned from within the template with the assign
function are also displayed this way.
I thought that a variable assigned in php (e.g. $foo='123') can be accessed
in the template in the same way smarty-variables are accessed ({$foo}).
index.php:
<?php
define ('SMARTY_DIR','/var/www/html/CMS/smarty/');
require SMARTY_DIR.'libs/Smarty.class.php';
$smarty = new Smarty;
$foo="123";
$smarty->display("index.tpl");
?>
index.tpl
<htmlt><head></head><body>
{$foo}
</body>
Output:
<htmlt><head></head><body>
</body>
Where's my fault?