On Sun, Sep 16, 2012 at 4:28 AM, Yahav
<yahav....@gmail.com> wrote:
Hello,
I've been planing to rewrite my projects to use Savant for a while now,
only thing is, i can't seem to use vars defined in the php file directly at the tpl files, etc:
//index.php
<?
...
$a = 'a';
...
$tpl->display('index.tpl.php');
?>
// index.tpl.php
<?
echo $a;
?>
The issue here is a question of scope. The $a variable is declared inside a different scope and will not be available within the template file.
With Savant3, your best bet is to assign what you need before displaying the template OR define a helper which will be available everywhere.
The next-generation of Savant: Savvy and PEAR2_Templates_Savant, allow you to specify global variables available within every template. You might try using Savvy or PEAR2_Templates_Savant.
Hope that helps.
--
Brett Bieber