所以我需要这样的东西:
上一页 1 ... 5 6 7 8 ... 56 下一页
这就是我的观点:
<?php if ($this->pageCount>1):?>
<div class="paginator">
<!-- Ссылка на предыдущую страницу -->
<?php if (isset($this->previous)): ?>
<a class="next" href="<?php echo $this->url(array( 'id' => $this->element_id,'sortby'=>$this->sortby,'page' => $this->previous), $this->route.'_pagination'); ?>">
<?=$this->translator()->_('previous');?>
</a>
<?php endif; ?>
<!-- Нумерованные ссылки на страницы -->
<?php foreach ($this->pagesInRange as $page): ?>
<?php if ($page != $this->current): ?>
<a class="numbers" href="<?php echo $this->url(array( 'id' => $this->element_id,'sortby'=>$this->sortby, 'page' => $page), $this->route.'_pagination'); ?>">
<?php echo $page; ?>
</a>
<?php else: ?>
<a class="active" href="#"><?php echo $page; ?></a>
<?php endif; ?>
<?php endforeach; ?>
<!-- Ссылка на следующую страницу -->
<?php if (isset($this->next)): ?>
<a class="prev" href="<?php echo $this->url(array( 'id' => $this->element_id,'sortby'=>$this->sortby,'page' => $this->next), $this->route.'_pagination'); ?>">
<?=$this->translator()->_('next');?>
</a>
<?php endif; ?>
</div>
<?php endif; ?>
这是我的控制器,功能索引:
public function indexAction()
{
if ($this->getRequest()->isXmlHttpRequest()) $this->_helper->layout->disableLayout();
$mapper = new Album_Model_Mapper_Album();
$user_id = $this->_request->getParam('id');
$adapter = new Zend_Paginator_Adapter_DbSelect($mapper->getUserAlbums($user_id));
$paginator = new Zend_Paginator($adapter);
$settings = $this->getFrontController()->getParam('bootstrap')->getOption('settings');
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage($settings['albums_per_page_profile']);
$paginator->setPageRange(4);
$this->view->route = 'albums';
$this->view->paginator = $paginator;
$this->view->user_id = $user_id;
$this->view->current_page = $this->_getParam('page') ? $this->_request->getParam('page') : 1;
if((!isset($this->view->current_page) or $this->view->current_page==1) and $user_id==$this->getStorage()->read()->id){
$mapperFilters = new Filters_Model_Mapper_PhotoFilters();
$this->view->filter = $mapperFilters->fetchBySql($mapperFilters->getUserPhotos($this->getStorage()->read()->id)->limit(1), true, true);
}
echo $this->view->render('albums.phtml');
}
现在我有这样的东西:
上一页 2 3 4 5 下一页
我不知道如何将其更改为:
上一页 1 ... 5 6 7 8 ... 56 下一页
请帮忙!