这有点神秘,特别是在第1天。如果你不介意,可以使用一些帮助。控制器是在action_query($ search_term)
上搜索的现在它的/ search / query / some query?page = 1(这是没有路由的) 需要以这种格式设置..
/ search / some query / 1
1是具有分页的页面
$pagination = Pagination::factory(array(
'current_page' => array('source' => 'route', 'key' => 'page'),
'total_items' => $count,
'items_per_page' => 100,
'view' => 'pagination/basic',
));
使用路线
Route::set('page', '<controller>/<action>/<search_term>(/<page>)')
->defaults(array(
'action' => 'query',
'search_term' => '[a-zA-Z0-9 ]',
'controller' => 'search',
'action' => 'page',
'page' => '1',
)
);
答案 0 :(得分:1)
我有一个分页工作,我的路线看起来像:
Route::set('comments', 'welcome/index(/<page>)', array('page' => '[0-9]+'))
->defaults(array(
'controller' => 'welcome',
'action' => 'index'
));
另外,我认为你在创建paginator时缺少一个参数,即:
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality.