CodeIgniter Forums
Paging URI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Paging URI (/thread-12037.html)



Paging URI - El Forum - 10-03-2008

[eluser]Unknown[/eluser]
Hi,

I'm having problem on handling pagination URI segments. It behaves nice when it recognized the page using a segmented value, but for the first page without any value in the segment it returns error.

For example :

http://localhost/ci/request.html/20 (this uri behaves correctly)
http://localhost/ci/request.html (this returns a '404 Page Not Found' message)

Here are the details of my configurations and codes. Please advice what went wrong ?

routes.php
Code:
$route['default_controller'] = "maincontroller";
$route['scaffolding_trigger'] = "scaffolding";
$route['article'] = "maincontroller/article";
$route['request'] = "maincontroller/request";
$route['request.html/:num'] = "maincontroller/request";

config.php
Code:
$config['base_url']    = "http://localhost/ci/";
$config['uri_protocol']    = "AUTO";
$config['url_suffix'] = ".html";

request.php controller
Code:
$this->load->library('pagination');
$config['full_tag_open'] = "<div class='paging'>";
$config['full_tag_close'] = "</div>";
$config['base_url'] = base_url() . "request.html";
$config['total_rows'] = '200';
$config['per_page'] = '20';
$config['first_link'] = '&lsaquo; Awal';
$config['uri_segment'] = 2;

$this->pagination->initialize($config);

$this->data["paging"] = $this->pagination->create_links();

Thanks,

JarBis


Paging URI - El Forum - 10-03-2008

[eluser]gRoberts[/eluser]
could it be because of the .html extension is missing from the route?

Code:
$route['request'] = "maincontroller/request";
$route['request.html/:num'] = "maincontroller/request";

to

Code:
$route['request.html'] = "maincontroller/request";
$route['request.html/:num'] = "maincontroller/request";