Sunday, January 31, 2010

Associated Pagination

Hello, I know this might be kind of a newbie question but hope you
could help.

I have 2 tables, Galleries and Photos.

One Gallery has many Photos

On my Gallery View/$id I have the common: "Gallery related Photos"
view.

What I want is to paginate the Related Photos.

I tried adding: $this->set('photos', $this->paginate("Photo")); in the
View Function.

so...

function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid Gallery.', true));
$this->redirect(array('action'=>'index'));
}
$this->set('photos', $this->paginate("Photo"));
$this->set('gallery', $this->Gallery->read(null, $id));

}

but its not working.. so... any idea?!

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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 For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: