Re: [SMARTY] Using a Smarty Variable in an External PHP script

From: Date: Mon, 10 Jun 2002 14:25:14 +0000
Subject: Re: [SMARTY] Using a Smarty Variable in an External PHP script
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4729@lists.php.net to get a copy of this message
use the {include_php} function to include your code, and you can assign template variables in the code like this: $this->assign('foo','bar'); Williams, Avern wrote:
Inside a smarty template, I would like to execute external php code that looks like the following: <? // include phpnav class include 'phpnav.class.php'; // create phpnav object for given database $php_nav = new phpNav('link_db.txt'); // create a 'trail' object for a given argument $trail =& $php_nav->create('trail', 'Articles'); // print trail object html print $trail->html(); ?> Most importantly, I would like the script's "Article" argument to be a dynamically assigned smarty template variable. Is there a way to call the external php code and pass it a smarty template variable, all within the smarty template? Do I have to pull the external code into smarty and make it a plug-in? Thanks in advance, Avern
-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

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