How do I create multiple pagination instances for a single model/controller in CakePHP?

I misunderstood your original question. If you want to set different limits to each action, you can do this.

I misunderstood your original question. If you want to set different limits to each action, you can do this function discover_list() { $this->paginate'limit' = 8; $this->paginate'conditions' = array('Item. Discover_order' => null, 'Item.

Moderated' => 1); $this->set('d_ajax_items', $this->paginate('Item')); } Edit A little nice way $this->paginate = array( 'limit' => 8, 'conditions' => array('Item. Discover_order' => null, 'Item. Moderated' => 1), ); $this->set('d_ajax_items', $this->paginate('Item')).

This looks good. I'll have to try it a little later, but thank you very much! Just out of curiosity, how could I have made it a little clearer?

– dclowd9901 Nov 2 '10 at 15:18 Worked brilliantly, dude. Thank you very much! – dclowd9901 Nov 3 '10 at 0:16.

I've done this before and I wished I hadn't. Keeping the two in synch is confusing for the end user and a nightmare for the developer. What have you tried already?

I'm sure you can have two instances, but you'll need to pass the parameters directly into the function paginate() rather than setting them on the class variable paginate. Edit To avoid confusion I almost always define the pagination options in the call itself. In your second example, you pass six parameters to paginate() but it only takes three: function paginate($object = null, $scope = array(), $whitelist = array()) If you omit $object and pass an array as the first arg, the last two args move to the left.

Have you tried entering the order and limit values as an array in the third position ($whitelist)? api13.cakephp.org/class/controller#metho... api13.cakephp.org/view_source/controller....

Understood on your first point. This is a client demand :) Check my updated question for more information. – dclowd9901 Nov 2 '10 at 13:15 It always is.

I'll check when I get home. – Leo Nov 2 '10 at 14:13.

You can start your page with 2 empty divs and call via ajax 2 different urls mapped to controller/action. Then you only have to worry about ajax pagination, but you won’t have any cakephp issue because each pagination works into his own action. This is not a really good approach if you want unbostrusive javascript, but if your entire app require javascript, it will work.

The problem isn't in the javascript so much as it's in Cake. I need the backend to feed in the right data. The AJAX pagination works beautifully using the method you describe.It's just the datasets that the framework is handing back that is wonky.

– dclowd9901 Nov 2 '10 at 13:14.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions