我使用过Magento 1.8.1.0版本,根据我的要求,我创建了一个自定义分页。其中没有显示分页链接。在phtml文件中,我添加了行$this->getPagerHtml()
// model intiate
private function getModel() {
return Mage::getModel('retailers/retailersmodel');
}
// set the collection
public function __construct() {
parent::__construct();
$model = $this->getModel();
$collection = $model->getCollection();
$this->setCollection($collection);
}
//custom pagination code
protected function _prepareLayout() {
parent::_prepareLayout();
$pager = $this->getLayout()->createBlock('page/html_pager', 'custom.pager');
$pager->setAvailableLimit(array(5 => 5, 10 => 10, 20 => 20, 'all' => 'all'));
$pager->setCollection($this->getCollection());
$this->setChild('pager', $pager);
$this->getCollection()->load();
return $this;
}
public function getPagerHtml() {
return $this->getChildHtml('pager');
}
谢谢你的想法和建议。