Re: Pagination Limit Default Global AppController CakePHP 2.x
If you define a $paginate var in AppController, it's going to be
overwritten in your other controllers. What you could do instead is
put it in AppController::beforeFilter() like so:
$this->paginate['limit'] = 15;
Just remember to have parent::beforeFilter() in your other
controllers' beforeFilter callbacks.
On Tue, Sep 18, 2012 at 5:38 PM, TonyCharlotteCakePHP
<tonylisanti@gmail.com> wrote:
> Well it seems like cakephp's default limit for pagination is 20. For
> instance, if limit is not set for pagination, then cakephp will display 20
> records when using pagination. I can set the limit for each individual
> controller with:
>
> public $paginate = array(
> 'limit' => 15
> );
>
> but I'm wanting to set this globally for all controllers/actions. I figured
> I could set limit to 15 within the AppController (using the same code above)
> but I still get 20 records for pagination within my other controllers/action
> where limit has not been set.
>
> On Thursday, September 13, 2012 4:42:53 PM UTC-4, TonyCharlotteCakePHP
> wrote:
>>
>> Is it possible to set or change the limit of pagination globally for all
>> controllers?
>>
>> I've tried adding the below to the AppController:
>>
>> public $paginate = array(
>> 'limit' => 15
>> );
>>
>> Thanks
>
> --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home