Re: [SMARTY] Variables in includes

From: Date: Thu, 25 Jul 2002 14:39:35 +0000
Subject: Re: [SMARTY] Variables in includes
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5445@lists.php.net to get a copy of this message
Not necessary FYI, included templates inherit the variables of parent templates. Johannes Schill wrote:
main.tpl: <HTML> <HEAD> <TITLE> {$title} </TITLE> </HEAD> <BODY> {include file="index.tpl" text=$text title=$title} </BODY> </HTML> and.. index.tpl: ($text} <BR> ($title} Good luck Johannes ----- Original Message ----- From: "Renaud Binse" <rbinse@profileup.com> To: <smarty-general@lists.php.net> Sent: Thursday, July 25, 2002 4:30 PM Subject: [SMARTY] Variables in includes
Hi, I've got a little problem with variable scope. Here is my code: Index.php: $smarty = new Smarty(); $smarty->assign('title', 'Title'); $smarty->assign('text', 'Test'); $smarty->display('main.tpl'); main.tpl: <HTML> <HEAD> <TITLE> {$title} </TITLE> </HEAD> <BODY> {include file="index.tpl"} </BODY> </HTML> index.tpl: ($text} <BR> ($title} On my browser I get : ($text} ($title} instead of "Test Title" Did I miss something ? Thanks a lot if you can help me.
-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

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