Re: [SMARTY] Output of an Array variable in an object

From: Date: Thu, 14 Nov 2002 07:10:30 +0000
Subject: Re: [SMARTY] Output of an Array variable in an object
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6425@lists.php.net to get a copy of this message
Thx, i forgot to mention, that my array movieList is an array of movie's. movieList[1]...movieList[max]. And movieList is in the object $db_movie Here the example to get the title of movie Nr. 5 - $db_movie->movieList[5]->get_title(). - $movieList is non-assoziative array of movie objects. It's sounds a little bit comlicated. My question was where must be the loop (i=1 to i=count[movieList]) over the array of objects. In the template or template. I think i'm right, that's impossible to call member function in the templates. 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

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