I looked over group, blogs, bakery, api, code, etc. and i can't seem
to figure this one out.

I'm paginating like suggested here:
http://cakebaker.42dh.com/2007/10/17/pagination-of-data-from-a-habtm-relationship/

But where the article ends/is missing is what do you do in your view?

Specifically, if you look below at the code from my view, I would
assume that "User.name" would work, and it does as far as sorting by
the correct field, but the direction is always "asc", it never
changes. I dont have enough records in my database yet to go over 1
page, so i don't know if this affects the page numbers as well.

My views/users/category.ctp

<th><?php echo $paginator->sort(__r('Name'), 'User.name');?></th>
 __r() is a wrapper so i dont have to type 'true'

Any help is appreciated.

P.S. I assumed this based on the above article:

My models/user.php
class User extends AppModel {
    var $hasAndBelongsToMany = array('Category' => array('with' =>
'CategoriesUser'));
}

My controllers/users_controller.php
class UsersController extends AppController {
    // called via ajax from categories/view
    function category($category_id = null)
    {
        if ($category_id)
        {
//            $this->paginateHolder();
            $users = $this->paginate('CategoriesUser',
array('Category.id'=>$category_id));
            $this->set('users', $users);
        }
        $this->layout = 'ajax';
    }
}

--~--~---------~--~----~------------~-------~--~----~
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