[eluser]cyrigniter[/eluser]
Hello,
I have set two rules :
Code:
$route['followers/(:num)'] = 'hall/filter/subscribers/$1';
And :
Code:
$route['see/(:num)'] = 'hall/see/$1';
But while the first one is working all fine, the second one behaves juste like the 2nd argument (the :num) wasn't passed at all (displaying see/4 gives the hall/see/ page, not hall/see/4 !). This is very odd because from my point of view, those 2 routes work the same way !!
Even stranger, if I change
Code:
$route['see/(:num)']
to
Code:
$route['foo/see/(:num)']
then it works !
Any idea ? Thanks
[eluser]toopay[/eluser]
Since CodeIgniter was written in PHP, i believe ' is different with ", for example you have declared a variable,
then that will be different if you do
and
. And in your issues with CodeIgniter routes, that would be a problem
[eluser]cyrigniter[/eluser]
lol, as stated on stackoverflow, this has nothing to do with my problem, for 2 reasons :
- the working example provided works with single quotes
- I changed everything to double quotes and it didn't change a thing
[eluser]toopay[/eluser]
Well, just guessing you put your controller into sub folder, then this maybe what you need
Code:
$route['see/(:num)'] = "hall/see/index/$1";
Because its almost likely you have "hall" as sub folder in your controllers directory, and filter controller which have subscribers function. Thats the common uri routes in CI. I just can't believe quickly, then CI Route, as you quote as your thread title, fails only for you but works for other thousand developer who use it.
If you want to collaborate this issue more, post your controller here

[eluser]cyrigniter[/eluser]
my controller is 'hall', filter is my function, broadcaster is argument #1, the number is argument #2 :/
[eluser]toopay[/eluser]
As i stated, if you want to ellaborate this issue more, post your controller here... For sure, something was wrong with that...
[eluser]cyrigniter[/eluser]
Solved :
Actually I was referring to my argument in 'see' function by using $this->uri->segment(3). I thought it'd work because the routing would remap this, but actually no, it puts the real value in $this->uri->rsegments[]. So I can either use this array or put the argument between ( and ) like in a normal function
Thanks Toopay
[eluser]InsiteFX[/eluser]
@Reneesh T K, and how many times are you going to post this?
[eluser]PhilTem[/eluser]
I don't want to feed any troll, but @Reneesh T K, I guess you haven't read the user's guide properly. If you look at the URI-class' class reference, you would have seen this line
Code:
$this->uri->rsegment(n);
which will do just what you needed.