[nycphp-talk] Smarty Template question
Rolan Yang
rolan at omnistep.com
Mon Oct 2 23:39:45 EDT 2006
The smarty template does not have to be a complete page. I believe you
can call a template multiple times from within the PHP document e.g.
$smarty->display('header.tpl');
$data=getTableData($first);
$smarty->assign('data',$data);
$smarty->display('tabletemplate.tpl');
$data=getTableData($second);
$smarty->assign('data',$data);
$smarty->display('tabletemplate.tpl');
$data=getTableData($third);
$smarty->assign('data',$data);
$smarty->display('tabletemplate.tpl');
$smarty->display('footer.tpl');
~Rolan
Cliff Hirsch wrote:
>
> I have a table comprised of a PHP file and Smarty template. It’s so
> lovely that I have decided to display it several times on one page,
> with different conditions for each iteration. Example: a table for
> pending projects, a table for completed project…terminated projects, etc.
>
> If the PHP and templates were built successively, I think this would
> work. But since, with Smarty, the PHP runs first and than the
> individual template “pieces” are populated with the assigned
> variables, the last “table build” would simply be displayed in all the
> tables. Follow me?
>
> Making each PHP version of the table an object would be simple. But
> how can I use one template for multiple instances on one page? The
> only solution I can think of it to build an array and have loop over
> the array for each version of the table. Any other ideas?
>
> Cliff
>
> _______________________________
> *Pinestream Communications, Inc.*
> Publisher of /Semiconductor Times/ & /Telecom Trends/
> 52 Pine Street, Weston, MA 02493 USA
> Tel: 781.647.8800, Fax: 781.647.8825
> http://www.pinestream.com <http://www.pinestream.com/>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
More information about the talk
mailing list