CodeIgniter Forums
how to make codeigniter routing to work with paging - 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: how to make codeigniter routing to work with paging (/showthread.php?tid=59883)



how to make codeigniter routing to work with paging - El Forum - 12-04-2013

[eluser]zoreli[/eluser]
I have the following routes for the news that works like a charm:

Code:
$word5 = urlencode('mygreek-keyword-here');
$route[$word5] = "news/displayAllNews";

and this page display all news with the desired keyword in the address bar. But...there is always a but...I have paging on this page, so when i click on next page link...page works but with old non-friendly seo url, that is:
Code:
news/displayAllNews/10/10

while I would like to have is: mygreek-keyword-here/10/10

code that i have in my controller for the paging is as follow:
Code:
$config['base_url'] = site_url('/news/displayAllNews/'.$limit.'/');
what should i do in routes.php and in my controller to get the desired result?

Regards, zoreli


how to make codeigniter routing to work with paging - El Forum - 12-04-2013

[eluser]CroNiX[/eluser]
Try this:
Code:
$route[$word5 . '/(.*)/(.*)'] = 'news/displayAllNews/$1/$2';
$route[$word5 . '/(.*)'] = 'news/displayAllNews/$1';
$route[$word5] = "news/displayAllNews";



how to make codeigniter routing to work with paging - El Forum - 12-05-2013

[eluser]v4et[/eluser]
I think that the problem is that ur class is displayAllNews

$route[‘displayAllNews/(:any)’] = urlencode('mygreek-keyword-here');


how to make codeigniter routing to work with paging - El Forum - 12-05-2013

[eluser]v4et[/eluser]
This are other ideas that edged programmers can turn in to something that work


$route[‘displayAllNews/(:any)’] = "SELF" , /urlencode(mygreek-keyword-here)";
$route[‘displayAllNews/(:any)’] = $SELF['urlencode('mygreek-keyword-here')'];
$route[‘displayAllNews/(:any)’] = "displayAllNews" , "/urlencode(mygreek-keyword-here)";



how to make codeigniter routing to work with paging - El Forum - 12-06-2013

[eluser]Tpojka[/eluser]
Not likely. CI object when is looking for urlencode('my-greek-keyword-here') controller can't find a thing
so any of those solutions would be returned as 404 Page Not Found.
CroNiX's proposal should be tested.


how to make codeigniter routing to work with paging - El Forum - 12-08-2013

[eluser]v4et[/eluser]
Then make it find the same controller but with the url encode as he wants,is that not possible?