为自定义页面加page
来源:互联网 发布:视频矩阵的工作原理 编辑:程序博客网 时间:2024/06/06 01:26
protected function _prepareLayout() { $pager = $this->getPagerBlock(); // called prepare sortable parameters $collection = $this->getImportedProducts(); //attention: $collection is some kind of collection // set collection to toolbar and apply sort $pager->setLimit($this->limit); $pager->setCollection($collection); $pager->setShowFilterForm(true); $pager->setShowAmounts(false); $pager->setShowPerPage(false); $pager->setShowProductFilter(1); $pager->setUseContainer(false); $pager->setJump(false); $this->setChild('pager',$pager); return parent::_beforeToHtml(); } public function getPagerBlock() { $pagerBlock = $this->getLayout()->createBlock('page/html_pager') ->setTemplate('homesup/catalog/pager.phtml'); return $pagerBlock; }
after add the code in block files, then add <?php echo $this->getChildHtml('pager'); ?> in your template file.