i have the solution
| From: | Kai-Uwe Beyer | Date: | Thu, 14 Nov 2002 11:29:31 +0000 |
| Subject: | i have the solution | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6429@lists.php.net to get a copy of this message | ||
i can read in the template over $movieList with {section} {/section} and
then i get access to the properties of the
object $movieList[i]->title ...
ksi
Manfred Stienstra schrieb:
>
> On Wednesday 13 November 2002 16:30, Kai-Uwe Beyer wrote:
>
> > - $movieList[i] array of Elements like $title,$date,$rate etc. with
> > getter and setter functions (get_title())
> >
> > Now i want to move some elements of movieList (from i=1 to
> > count($movieList) in a teble of a template.
> > What is the best solution for it. Assign the object to the template or
> > an array?
> > Where will the loop be? In the template or better than in the php File.
>
> in php:
>
> $movieList = whatever_to_do_to_get_the_list();
> $smarty->assign('movielist', $movieList);
> $smarty->display('list');
>
> in smarty (list.tpl):
>
> {foreach from=$movieList item=movie}
> <p>
> {$movie.title} {$movie.date} {$movie.rate}
> </p>
> {/foreach}
>
> > Is this possible:
> >
> > <loop>
> > $smarty->display('template.tpl');
> > </loop>
> >
> > template.tpl is an include template of the main.tpl an will repeat i
> > times.
>
> That is not possible, I mean that is possible, but that is not the proper way
> to use smarty.
>
> Manfred
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php