Hi there,

Have you looked at this post:
http://cakebaker.42dh.com/2007/10/17/pagination-of-data-from-a-habtm-relationship/

That would translate into this for you, if I'm guessing it right:

<?
// app/controllers/albums_controller.php
class AlbumsController extends AppController {
    public $paginate = array( 'Gallery' => array('limit' => 4, 'joins' =>
array(
        array(
            'table' => 'albums_galleries',
            'alias' => 'GalleriesAlbum',
            'type' => 'inner',
            'conditions'=> array('GalleriesAlbum.gallery_id = Gallery.id')
        ),
        array(
            'table' => 'albums',
            'alias' => 'Albums',
            'type' => 'inner',
            'conditions'=> array(
                'Albums.id = GalleriesAlbum.album_id',
                'Albums.id' => '1'
            )
        ))));

    public function index() {
        $data = $this->paginate('Gallery');
        debug($data);
        exit;
    }
}

Cheers,


On Mon, Aug 20, 2012 at 6:53 PM, André Luis <[email protected]> wrote:

> Hi people, i´ve searched for it but I didnt find anything wich really
> works.
>
> I have some Albums, wich the model is Album, and Album HABTM Gallery, so a
> gallery can be visible in more than one album. It works fine, BUT i need to
> create a pagination for galleries, and all that i´ve found here didnt work
> for me. What i need is to use a specific Album to paginate a gallery. Is
> that possible? and how can be done?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.


Reply via email to