Re: [SMARTY] Variables assigned from PHP

From: Date: Tue, 06 May 2003 11:11:23 +0000
Subject: Re: [SMARTY] Variables assigned from PHP
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9480@lists.php.net to get a copy of this message
you are missing an assign statement $smarty->assign("foo",$foo); Carsten wrote:
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?
-- .::....::.:...::...:..:.:::..:..:..::.:..:..:::..:::...::..:.. :: PUBLIC VOICE Lab :: Alexey Kulikov :: :: The International Media Coop :: alex@pvl.at :: :: www.pvl.at :: phone: +43 699 1 9228792 ::

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