1

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')));

$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

skog
  • 31
  • 1
  • 4
  • Strange error. Try this: echo $pag->uri(2); It should return 'blog/1/page2' – biakaveron Dec 07 '10 at 13:56
  • It returned: Fatal error: Call to undefined method Pagination::uri() – skog Dec 07 '10 at 16:21
  • Doesn't sound like a problem with Kohana but with your server rewrite rules. If you can update your post with the relevant lines from your server configuration then I'm sure we can figure it out. – The Pixel Developer Dec 08 '10 at 15:08

1 Answers1

4

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.

shadowhand
  • 3,202
  • 19
  • 23