2013-02-07 71 views
1

我最近升級了我的FuelPHP到v1.5。現在我正在嘗試設置分頁類。FuelPHP分頁問題

這是我的代碼:

$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的副本app/config/pagination.php。 而就我的看法news/index.php分頁是seted:<?php echo $pagination ?>

結果:通過查詢獲得的信息都正常顯示,但是字符串$分頁返回任何內容。燃油顯示沒有錯誤。

我該怎麼辦?謝謝。

回答

0

在您看來,打印與分頁:

<?php echo \Pagination::create_links(); ?> 

,而不是

<?php echo $pagination ?> 
1

在新版本Fuelphp,請在此視圖中進行更改:

echo html_entity_decode($pagination); 

並更新分頁配置文件。 下面是給出的一些變化。

'previous-marker'   => "<", 
//and 
'next-marker'    => ">" 
+0

...也適用於_v1.8_ – MrIsaacs