Welcome Guest, Not a member yet? Register   Sign In
how to make codeigniter routing to work with paging
#1

[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
#2

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

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

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

[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)";
#5

[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.
#6

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




Theme © iAndrew 2016 - Forum software by © MyBB