Google Groups

Re: Hello There, Little Question Regarding Savant

Brett Bieber Mar 20, 2011 1:49 PM
Posted in group: PHP Savant

On Sun, Mar 20, 2011 at 7:54 AM, Yahav Shasha <> wrote:
Hello Brett,
I Found Savant as a really clean yet solid alt to Smarty,
one question though:
say i want to include X.tpl.php to Y.tpl.php is it something that i can do?
in smarty that would be:
{include file='cp/header.tpl'}
so i guess with Savant i can just simply use
<? include("/tpls/x.tpl.php");?>
inside the Y.tpl.php file?
would this work fine?

Sure, you can do that with savant. Or you can also use: $this->display('x.tpl.php');

If you're looking for isolated child templates with inheritance, you might try Savvy (next generation of Savant), which is in beta right now. In Savvy, you'd use <?php echo $savvy->render($context->data, 'x.tpl.php'); ?>, then inside x.tpl.php you can use $parent->context; to access the parent context.

Brett Bieber