当我访问
时domain.com/packages
不显示任何数据,但会显示行数。
我的行动是
function admin_index()
{
$this->paginate = array('limit' => 10, 'order' => array('price' => 'asc'));
$this->set('packages', $this->paginate());
}
但是,当我点击其中一个表格标题对数据进行排序时,数据会显示出来。单击排序标题时的URL是
domain.com/packages/index/page:1/sort:name/direction:asc
我的观点是
foreach ($packages as $package):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td>
<?php echo $package['BuyItPackage']['name']; ?>
</td>
<td>
<?php echo $number->currency($package['BuyItPackage']['price'], $appConfigurations['currency']); ?>
</td>
</tr>
<?php endforeach; ?>