几个月前,我开始学习zend框架和MVC概念。我注意到使用zend paginator的css有问题。当我打开第一页时,一切都还可以,但是当我转到下一页时,css样式会爆发(在我的main.css文件中,我有来自layout.phtml的代码)。
引导路线:
$routes['indexController-paginatorAction'] = new Zend_Controller_Router_Route(
'/paginator/:page', array(
'module' => 'default',
'controller' => 'index',
'action' => 'paginator',
'page' => 1
));
将文本返回到paginate的类:
class Application_Model_Paginator extends Zend_Db_Table_Abstract{
protected $_name = 'text';
public function getText($page, $count = 1)
{
$query = $this->select();
$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($query));
$paginator->setCurrentPageNumber($page)->setItemCountPerPage($count);
return $paginator;
}
}
控制器操作:
public function paginatorAction()
{
$page = $this->getParam('page');
$textModel = new Application_Model_Paginator();
$text = $textModel->getText($page, 1);
$this->view->text = $text;
}
Paginator控制:
<div id="pagination-box">
<div>
<?php $pageVariable = ($this->page)?$this->page: 'page'?>
<div>
<p>Page <?= $this->current ?></p>
</div>
</div>
查看:
<div class="pag-row">
<?= $this->paginationControl($this->text, 'Sliding', array('paginator.phtml', 'default')); ?>
</div>
<div>
<?php
foreach($this->text as $row)
{
echo $row['text'];
}
?>
</div>
任何人都知道出了什么问题?