Routing issue - Pagination not working properly - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Routing issue - Pagination not working properly (/showthread.php?tid=49264) |
Routing issue - Pagination not working properly - El Forum - 02-14-2012 [eluser]Mauricio de Abreu Antunes[/eluser] I'm still getting error! Again: if i dont use routes, when i go for http://localhost/percutz/noticias/2 shows error 404. My .htaccess supress index.php from my controllers. http://localhost/percutz/index.php/noticias/ (i dont need this) If i go for http://localhost/percutz/noticias/index/2 shows properly. Please, help me to understand my error. Routing issue - Pagination not working properly - El Forum - 02-14-2012 [eluser]Aken[/eluser] Post your entire controller and routes as they sit right now. Routing issue - Pagination not working properly - El Forum - 02-14-2012 [eluser]Mauricio de Abreu Antunes[/eluser] Hi! My routes.php Code: $route['default_controller'] = 'welcome'; My news.php (controller) Code: public function index() { My pagination.php (config) Code: //Primeiro e último link. Routing issue - Pagination not working properly - El Forum - 02-14-2012 [eluser]Mauricio de Abreu Antunes[/eluser] [quote author="Aken" date="1329264103"]No, his URLs aren't working. That's why when he's on Page 2, it acts like Page 1, unless he includes the index() method.[/quote] I was wondering this, but what can i do? Routing issue - Pagination not working properly - El Forum - 02-14-2012 [eluser]Aken[/eluser] Add what I recommended above in post #7 to your controller. Also, your route doesn't need the extra stuff after news, since you aren't passing the pagination value as a parameter. Code: $route['news/(:num)'] = 'news'; Routing issue - Pagination not working properly - El Forum - 02-14-2012 [eluser]Mauricio de Abreu Antunes[/eluser] [quote author="Aken" date="1329268403"]Add what I recommended above in post #7 to your controller. Also, your route doesn't need the extra stuff after news, since you aren't passing the pagination value as a parameter. Code: $route['news/(:num)'] = 'news'; It did not solve my problem. When i go for http://localhost/percutz/noticias It shows 1 2 > (its ok) But when i go for http://localhost/percutz/noticias/2 1 2 > (and i can not access 1 page anymore...) Routing issue - Pagination not working properly - El Forum - 02-14-2012 [eluser]Aken[/eluser] Does your route actually say news, or did you translate it to noticias? Also, a small fix to what I said about that route - you don't need the parentheses if you aren't going to reuse that segment. Code: $route['noticias/:num'] = 'news'; You have something small wrong somewhere. It might be worth starting from scratch and add code until you find where the problem is. Routing issue - Pagination not working properly - El Forum - 02-14-2012 [eluser]Mauricio de Abreu Antunes[/eluser] Ok, ill recode. Anyway, thanks. Routing issue - Pagination not working properly - El Forum - 02-14-2012 [eluser]Mauricio de Abreu Antunes[/eluser] GOD, help me! I can not solve this. I just watched http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-7-pagination/! I do the same thing and create_links is not working for me. Routing issue - Pagination not working properly - El Forum - 02-14-2012 [eluser]Mauricio de Abreu Antunes[/eluser] Something is wrong with my URL. http://localhost/percutz/noticias/index/2 (working) http://localhost/percutz/noticias/2 (not working) My .htaccess file can influence it? Code: DirectoryIndex index.php |