【发布时间】:2010-02-19 06:12:23
【问题描述】:
朋友们,
我想在 Zend Framework 中创建分页。我是采埃孚的新手。
index.phtml 如下所示
<table>
<tr>
<th>Name</th>
<th>Quantity</th>
<th> </th>
</tr>
<?php foreach($this->orders as $order) : ?>
<tr>
<td><?php echo $this->escape($order->name);?></td>
<td><?php echo $this->escape($order->quantity);?></td>
<td>
<a href="<?php echo $this->url(array('controller'=>'index','action'=>'edit', 'id'=>$order->id));?>">Edit</a>
<a href="<?php echo $this->url(array('controller'=>'index', 'action'=>'delete', 'id'=>$order->id));?>">Delete</a>
</td>
</tr>
<?php endforeach; ?>
</table>
<p><a href="<?php echo $this->url(array('controller'=>'index','action'=>'add'));?>">Add new album</a></p>
我的索引控制器在下面
class IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$this->view->title = "My Orders";
$this->view->headTitle($this->view->title, 'PREPEND');
$orders = new Model_DbTable_Orders();
$this->view->orders = $orders->fetchAll();
}
}
【问题讨论】:
-
我收到了一条回复,但我尝试只获得部分输出。我创建了一个“pagination.phtml”并将其存储在“views/scripts/”中,并将给定的行添加到我的 index.phtml '$this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml');.但是只显示前10个项目,不显示下一个-上一个链接。如何解决??
标签: zend-framework