I have news with comments. I'd like to paginate comments but I have the errors like this:
Notice (8): Undefined index: count [CORE\Cake\View\Helper\PaginatorHelper.php, line 646]
and of course I don't see numbers, links etc.
Do you have any idea how to solve this problem? Thanks!
Component:
public function viewFromNewsId($news_id = null) { $this->NewsComment->recursive = 0; $this->Paginator->settings = array('conditions' => array('NewsComment.news_id' => $news_id, 'NewsComment.is_active' => '1'), 'limit' => 5, 'order' => array('NewsComment.id' => 'desc')); $newsComments = $this->Paginator->paginate('NewsComment'); if (isset($this->params['requested'])){ return $newsComments; } }
Element:
$newsIdFromUrl = $this->params['pass'][0]; $newsComments = $this->requestAction("newsComments/viewFromNewsId/$newsIdFromUrl"); foreach($newsComments as $newsComment): $this->App->showNewsComment($newsComment); endforeach; echo $this->Paginator->counter('Liczba newsów: {:count} | '); echo $this->Paginator->prev('<< wstecz', null, null, array('class' => 'disabledText')); echo $this->Paginator->numbers(array('separator' => ' ', 'before' => ' | ', 'after' => ' | ', 'modulus' => '10')); echo $this->Paginator->next('dalej >>', null, null, array('class' => 'disabledText')); echo "<br />";
View:
echo $this->element('newsViewComments');
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment