using variables set via assign() into an {include_php } template called script
| From: | g.p.ciceri | Date: | Thu, 02 May 2002 20:51:48 +0000 |
| Subject: | using variables set via assign() into an {include_php } template called script | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-4005@lists.php.net to get a copy of this message | ||
Hello all,
I've the following scenario:
1. in the main php script, I assign a variable
require_once("Smarty.class.php");
$smarty = new Smarty;
$smarty->assign("cippa", '<h2>perepepe</h2>');
and then I call a template
$smarty->assign("_model", 'temp/mysql-stc.php');
$smarty->display("mysql-dyn.tpl");
2. in the template, I call another php script via {include_php }
{*
filename: mysql.tpl
Smarty Template for displaying articles
*}
{include_php file="$_model"}
Now my question:
how can I get the value of $cippa inside my temp/mysql-stc.php
script ???
I can use something like (looking to a compiled template)
echo 'cippa: '.$this->_tpl_vars['cippa'];
And it works, but I wonder if there is an alternative,
simpler sintax.
Any help/remark will be highly appreciated.
THX
/gp
--
Discussion: How do you feel about Open Source firms making
millions through public offerings?
"I wish these companies were making the same millions without
distributing any non-free, user-subjugating software." --
Richard Stallman
"We're so forward that sometimes we reach ourself." --
g.p.
"It is amazing how much you can achieve when you don't have
to do the real work yourself." --
Joe Celko
Gian Paolo Ciceri Via B.Diotti 45 - 20153 Milano MI ITALY
I2BITM @ Cofiri mobile : ++39 347 4106213
: ++39 329 8103661
eMail : gp.ciceri@acm.org,
gp.ciceri@computer.org
: gp.ciceri@cofiri.it
webSite: http://www.cofiri.it
(forecoming)
ICQ # : 94620118