why are the normal 1.3 arrays not working for you? they also have all those functions built in (in plain php functions then of course)
On 5 Jul., 01:06, Zeu5 <[email protected]> wrote: > I have cars controller, Car model and views for cars. > > I am using Twig > 1.0,http://www.twig-project.org/doc/templates.html#list-of-control-struct... > Cake 1.3 > > I want to do the following in the controller: > > function index() { > > ... > > $carData = $this->Car->find('all'); > > $cars = Car::prepareForView($carData); > > $this->set('cars', $cars); > > } > > the prepareForView will turn the car data into an object that > implements the > IteratorAggregatehttp://php.net/manual/en/class.iteratoraggregate.php > > the reason is because i want to be able to do the following in the > view using Twig. > > {{ cars.size }} // returns me the size > {{ cars.first }} // returns me the first element of the array > {{ cars.last }} // returns me the last element of the array > > Am i right in wanting to prepare the array as an IteratorAggregate? > If i do this for Car and other models, how should i do it? > > Advice, please. Thank you. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
