On Nov 15, 10:15 pm, butangphp <[EMAIL PROTECTED]> wrote:
> I'm a beginner and struggling to use pagination correctly in cakephp.
> The Bakery recommends using this code in the controller.  I know its a
> dumb question, but do I need to create a function called index() in
> order to make this built in helper work ??
>
> <?php
> class PostsController extends AppController
> {
>     var $name = 'Posts'; // for PHP4 installs
>     var $components = array ('Pagination'); // Added
>     var $helpers = array('Pagination'); // Added
>
>     function index() {
>         $criteria=NULL;
>         list($order,$limit,$page) = $this->Pagination->init($criteria); // 
> Added
>
>         $data = $this->Post->findAll($criteria, NULL, $order, $limit,
> $page); // Extra parameters added
>
>         $this->set('data',$data);
>     }}
>
> ?>

Where is the nightmare?

Be aware that is code for 1.1 and you need to have the helper and
component also which don't come with cake and are linked to in the
tutorial. If you are using 1.2 it has pagination built in so you don't
need and shouldn't follow that tutorial.

Just to clarify: You can if you really want use the above code in 1.2,
but better to use what's built in if that's the case.

Cheers,

AD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to