开发者

How to get rid of trash in Kohana Pagination urls?

开发者 https://www.devze.com 2023-01-29 19:55 出处:网络
i\'ve a question on ko3 framework Pagination module. I have a route template like this: http://my-site.com/blog/1/page2

i've a question on ko3 framework Pagination module. I have a route template like this: http://my-site.com/blog/1/page2 Here's the code from my bootstrap.php file:

Route::set('blog', 'blog(/<id>(/page<page>))')->defaults(array('controller' => 'blog', 'id' => 1, 'page' => 1));

everything works nice, but Pagination library generates dirty urls like http://my-site.com/blog/1/page3?kohana_uri=blog%2F1.

Here's the code that creates the pagination (in Controller_Blog)

$pag = Pagination::factory(array('total_items' => $total_posts, 'items_per_page' => 10, 'current_page' => array('source' => 'route', 'key' => 'page')))开发者_C百科;

$posts = $posts_model->selectPosts($section_id, $pag->offset, $pag->items_per_page);

$this->template->content = View::factory('html/blog', array('pag' => $pag));

How can I tell the Pagination module generate clean urls? When I remove trash from url manually, it works too.

Thanks in advance


Your .htaccess file has something like this in it: RewriteRule .* index.php?kohana_uri=$0 [PT] which is fine, but setting the kohana_uri GET parameter does absolutely nothing in Kohana 3.x. The rewrite should point to index.php/$0 or just index.php.

0

精彩评论

暂无评论...
验证码 换一张
取 消