CakePHP分页,检索数据摘要但未显示数据

时间:2015-03-29 20:11:43

标签: php cakephp

这是我的行动

    function admin_index()
    {
        $this->paginate = array('limit' => $this->appConfigurations['adminPageLimit'], 'order' => array('price' => 'asc'));
        $this->set('packages', $this->paginate());
    }

我的观点

<?php if($paginator->counter() > 0):?>

<?php echo $this->element('admin/pagination'); ?>

<table cellpadding="0" cellspacing="0">
<tr>
  <th><?php echo $paginator->sort('name');?></th>
  <th><?php echo $paginator->sort('price');?></th>
  <th class="actions"><?php __('Options');?></th>
</tr>
<?php
$i = 0;
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>
    <td class="actions">
        <?php if($this->requestAction('/settings/enabled/multi_languages'))     : ?>
            <?php echo $html->link(__('Edit', true), array('action'=>'translations', $package['BuyItPackage']['id'])); ?>
        <?php endif; ?>
    </td>
</tr>
<?php endforeach; ?>
</table>

显示分页部分     显示1 - 5(5)

显示表头但没有显示数据,似乎没有输入foreach代码。

有什么想法吗?

0 个答案:

没有答案