Monday, December 26, 2011

Re: Paginate an array

http://book.cakephp.org/2.0/en/controllers.html#Controller::paginate 
--
Lep pozdrav, Tilen Majerle



2011/12/26 J. <contact.mysparetime@gmail.com>
People here are of great help, so I figured out I may ask here.

I have an Item controller (An Item is a post on my website) with this
function :

   public function index() {
       $this->set('items', $this->Item->find('all', array('limit' =>
5 )));
   }


When in view, I echo it out this like this :

<?php foreach ($items as $item): ?>


Before I put out the limit of 5 elements, all my site items (lots)
were displayed. Now it only displays 5. But how can I say that it only
displays 5 then a link to page 2 with posts 6 -> 10 then page 3
etc... ?


Thanks a lot. Cakephp is a very usefull tool but for someone new to
php and coding it can be hard to know where to search.


--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: