konto usunięte
Temat: [cakePHP] Paginator w elementach
Witajcie, niestety nigdzie nie znalazłem odpowiedzi na mój problem :(Mam news, do którego dodawane są komentarze, w view newsa dodaję element z komentarzami, komentarze chciałbym podzielić na strony i cały czas otrzymuję komunikaty typu Notice (8): Undefined index: count [CORE\Cake\View\Helper\PaginatorHelper.php, line 646]
Może będziecie wstanie mi pomóc?
Z góry dzięki!
Kontroler:
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 />";
I view:
echo $this->element('newsViewComments');