Bug or "feature" ? URI Routing issue |
[eluser]cyrigniter[/eluser]
Hello, I have set two rules : Code: $route['followers/(:num)'] = 'hall/filter/subscribers/$1'; Code: $route['see/(:num)'] = 'hall/see/$1'; Even stranger, if I change Code: $route['see/(:num)'] Code: $route['foo/see/(:num)'] Any idea ? Thanks
[eluser]toopay[/eluser]
Since CodeIgniter was written in PHP, i believe ' is different with ", for example you have declared a variable, Code: $foo = 'bar'; Code: echo '$foo'; Code: echo "$foo";
[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"; 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]Reneesh T K[/eluser]
I was also the same problem and I fixed it by a small change in URI.php page in the system/core In my checking I feel like it was due to a small bug in codeigniter. Anyway I am not an expert. Anyway I fixed it. I was a problem with codeigniter url rewriting. I have to go to www.abc.com/catalog/product/4354 when using the url www.abc.com/samsung_galaxy_y I have explained it in my blog. http://myphplibrary.blogspot.in/2012/03/...n-url.html
[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. |
Welcome Guest, Not a member yet? Register Sign In |