zend framework - Zend_Paginator stopped working -
zend framework - Zend_Paginator stopped working -
i'm learning zend framework. had zend_paginator working array adapter, i'm having problem using zend_paginator::factory static method. problem pagination command links send me right url, results disappear when click next or page 2, 3, etc.
i have 2 tables database: file table , origination_office table. file table has client's names, address, etc. , origination office stores office names (like tampa, sarasota, etc.). each file associated origination office.
my controller:
public function searchaction() { $searchform = new application_form_searchform(); if ($this->_request->getquery()) { if ($searchform->isvalid($this->_request->getparams())) { $officename = $this->_request->getparam('officename'); $page = $this->_request->getparam('page'); } $filetable = new application_model_dbtable_file(); $this->view->paginator = $filetable->getfilesbyofficename($officename, $page); } $this->view->searchform = $searchform; } here getfilesbyofficename() method:
public function getfilesbyofficename($officename = null, $page = 1, $count = 12, $range = 15, $scrolling = 'sliding') { if (is_null($officename)) { $query = $this->select(); $paginator = zend_paginator::factory($query); } else { $ooftable = new application_model_dbtable_originationoffice(); $query = $ooftable->select(); $query->where('oof_name ?', $officename.'%'); if ($ooftable->fetchrow($query)) { $origination_office = $ooftable->fetchrow($query); $files = $origination_office->finddependentrowset($this); $paginator = zend_paginator::factory($files); } else { return; } } zend_paginator::setdefaultscrollingstyle($scrolling); zend_view_helper_paginationcontrol::setdefaultviewpartial('_pagination_control.phtml'); $paginator->setdefaultitemcountperpage($count); $paginator->setdefaultpagerange($range); $paginator->setcurrentpagenumber($page); homecoming $paginator; }
ok, think understanding problem. links not maintaining state of initial request , it's url query string.
you might want edit partial view (_pagination_control.phtml) render current query string in links.
i need see doing in partial give exact answer, should work if add together ?$_server['query_string'] end of final url. see below example:
<!-- href may different notice append query string end --> <a href="<?php echo $this->url(array('page' => $this->last)); ?>?<?php echo $_server['query_string'];?>">last »</a> zend-framework zend-paginator
Comments
Post a Comment