Re: [SMARTY] Componentized Templates

From: Date: Fri, 19 Sep 2003 14:08:00 +0000
Subject: Re: [SMARTY] Componentized Templates
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10242@lists.php.net to get a copy of this message
On Thu, Sep 18, 2003 at 04:15:50PM -0300, Alvaro Nunes Melo wrote: > Now I'm trying to use the Componentized Templates tip as shown in the > documentation, but again I'm having some trouble. I have a simple > template and a PHP file the holds its logic, and another. If I used them > separatelly, they work fine, but using {include_php} tag is not working. > The files are above: > > **************************************** > This Works (URL: localhost/.../simple.php): > <!-- simple.php --> > > <? > define('SMARTY_DIR', '/usr/local/lib/php/Smarty-2.5.0/libs/'); > require_once(SMARTY_DIR . "Smarty.class.php"); > > $smarty = new Smarty; > > $foo = array(1, 2, 3, 4); > $smarty->assign("values", $foo); > $smarty->display("simple.tpl"); > ?> > > <!-- simple.tpl --> > <table border=1> > <tr> > {section name=s_columns loop=$values} > <td>{$values[s_columns]}</td> > {/section} > </tr> > </table> > this is easier with 'foreach': {foreach from=$values item="value"} <td>{$s_columns.$value}</td> {/foreach} hope this works / helps. - rob

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