我最近将我的 FuelPHP 升级到 v1.5。现在我正在尝试设置分页类。
这是我的代码:
$data['news'] = Model_News::find()->where('font', '>', -1);
$count = count($data['news']);
$config = array(
'pagination_url' => 'http://localhost/public/mobile/barbecue/',
'total_items' => $count,
'per_page' => 12,
'uri_segment' => 3,
);
$pagination = Pagination::forge('mypagination', $config);
$data['news'] = Model_News::find()->where('font', '>', -1)->order_by(array('date' => 'desc'))->limit($pagination->per_page)->offset($pagination->offset)->get();
$data['pagination'] = $pagination->render();
$this->template->title = "Teams";
$this->template->content = View::forge('news/index', $data);
我复制了core/config/pagination.php
to app/config/pagination.php
。在我看来news/index.php
,分页已设置:<?php echo $pagination ?>
结果:查询得到的信息正常显示,但字符串$ pagination什么也不返回。燃料显示没有错误。
我所做的?谢谢。