Following my post:
https://groups.google.com/group/cake-php/browse_thread/thread/21c8e24fdb4f4b34/f8fa633f9296867d?hl=en&q=related+users&lnk=ol&
...I have a query in the categories controller that uses "contain" and
fetches a category and all its associated posts:
$this->set(
'category',
$this->Category->find(
'first',
array(
'conditions' => array('Category.id' => $id),
'contain' => array(
'Post' => array(
'User' => array(
'id',
'username'
)
)
)
)
)
);
I added some code to the controller to paginate the results (on the
"subtable"), but it does not seem to do anything:
var $paginate = array(
'Post' => array(
'limit' => 2,
'page' => 1,
'order' => array(
'Post.created' => 'desc'
)
)
);
I put the following code under the "subtable" (after "</table>" tag)
in the view:
<p>
<?php
echo $this->Paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out
of %count% total, starting on record %start%, ending on %end%', true)
));
?> </p>
<div class="paging">
<?php echo $this->Paginator->prev('<< ' . __('previous', true),
array(), null, array('class'=>'disabled'));?>
<?php echo $this->Paginator->numbers();?>
<?php echo $this->Paginator->next(__('next', true) . ' >>',
array(),
null, array('class' => 'disabled'));?>
</div>
But I get the error:
Undefined property: View::$Paginator [APP\views\categories\view.ctp,
line 69]
What am I doing wrong?
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php