URL question |
[eluser]Sumon[/eluser]
Michael Wales i m a bit confused. For the lack of language skill i can't understand whether i can make you guys correct sense or not. anyway, my last post is not working..... would you please write a sample code so that i can be more clear.
[eluser]srobet[/eluser]
It was not so difficult i think. The controller : Code: function index() Routing : Code: $route['project/([a-zA-Z0-9-]+)'] = 'project/show_project/$1'; Try this on url : http://yourlocalhost/index.php/project/t...he-project Assume you didn't set the .htaccess.
[eluser]Sumon[/eluser]
Thanks...Still i am getting a surprising error. Really i am surprised. Let me post it here. Here is the project controller Code: class Project extends Controller Code: class Member extends Controller Code: $route['project/([a-zA-Z0-9-]+)'] = 'project/index/$1'; //Consider it Line 1 Right now member controller works fine for http://localhost/CodeIgniterModuleDev/member/123 But getting 404 error for http://localhost/CodeIgniterModuleDev/project/123 But if i interchange code of line 1 and 2. then works fine for http://localhost/CodeIgniterModuleDev/project/123 and getting same error http://localhost/CodeIgniterModuleDev/member/123 What's the reason why second route rule works but not both?
[eluser]Chicken's Egg[/eluser]
[quote author="Sumon" date="1217862183"] Code: $route['project/([a-zA-Z0-9-]+)'] = 'project/index/$1'; //Consider it Line 1 If I do understand you correctly, only the first router will work. If you turn them over one which didn't work will work and in reverse. I see you have got a - sign behind the 9 in both lines. The - sign does however have a meaning. What happens if you escape that character?
[eluser]Sumon[/eluser]
I have tried after remove - sign but result is same. Code: $route['project/([a-zA-Z0-9]+)'] = 'project/index/$1'; //Consider it Line 1
[eluser]Colin Williams[/eluser]
Just breezed through this thread and I am quite nonplussed. First, are you using CI >= Version 1.4.0? (regex routing was introduced in 1.4.0). Second, try double-quoting your route values, just for the sake of trying. Code: $route['project/([a-zA-Z0-9]+)'] = "project/index/$1"; //Consider it Line 1 And finally, make sure you don't have an application/libraries/MY_Router.php that could be altering something with how CI routes
[eluser]Michael Wales[/eluser]
I still can't understand why you would route something to the index() method - I can't think of a more non-descript method name, maybe asdf()...
[eluser]Sumon[/eluser]
My CI version is 1.6.3 and still surprising result. works fine one controller at a time but not both. shall i upload my application folder as zip?
[eluser]Sumon[/eluser]
[quote author="Michael Wales" date="1217953186"]I still can't understand why you would route something to the index() method - I can't think of a more non-descript method name, maybe asdf()...[/quote] yah this is very true, it's not good practice to route index() method. actually right now, this is just a test why one controller works fine but not both. at this moment, it's not my project related. so we can leave this topic but i highly interested to know why not both controller working simultaneously.
[eluser]Michael Wales[/eluser]
What if you don't route to index()? I've used the exact code you are using, with the exception of routing to the index() method and it works fine... |
Welcome Guest, Not a member yet? Register Sign In |