だから私はこのようなものが必要です:
前へ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');
}
今では私はこのようなものを持っています:
前へ2345次へ
これに変更する方法がわかりません:
前へ1...5 6 7 8...56次へ
助けてください!