You only need:
Models:
Define relation between master and detail model.
Mastermodel controller:
function view();
$this->Mastermodel->recursive = 1;
$this->set('mastermodel', $this->paginate("Mastermodel"));
mastermodel view:
foreach ($mastermodels as $mastermodel):
---Display mastermodel data
foreach ($detailmodels as $detailmodel):
-----Display detailmodel data
endforeach;
endforeach;
On 1 feb, 07:36, Changoso <mmosc...@gmail.com> wrote:
> 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:
Post a Comment