Segmentation URL |
[eluser]cinewbie81[/eluser]
Instead of www.mysite.com/index.php/myclass/myfunction/myparam&key=12345&name=testing Is there any way for me to make the url to be more simple and readable ? I was wondering if there's any way for me to hide the controller, function, and parameter segmentation from the url ??
[eluser]Chris Newton[/eluser]
You could hide the parameters by POSTing them instead of sending them as a query string.
[eluser]nate_02631[/eluser]
Unless you're only going to have only one controller and function, you at least have to show the function, and can use routing to hide the controller(s) (in routes.php).. i.e. Code: $route['myfunction' . '/(.*)'] = 'mycontroller/myfunction/$1'; Code: $route['(.*)'] = 'mydefaultcontroller/mydefaultfunction/$1'; Code: $route['mycontroller'] = 'mycontroller'; Assuming you are using mod_rewrite and use routing to hide myclass, the URL: www.mysite.com/index.php/myclass/myfunction/myparam&key=12345&name=testing becomes: www.mysite.com/myfunction/12345/testing ...which is passed to your myclass controller function as: Code: myfunction($key, $name) { www.mysite.com/admin/product/update/55
[eluser]Fatih[/eluser]
Hi everyone, I have a strange problem about segmentation URL. I have two different controllers and I want to use all of them with this method. Therefore I added two lines on routed.php like these: Code: $route['mycontroller1/(.*)'] = "mycontroller1/index/$1"; But it is interesting that, only mycontroller2 is working correctly. mycontroller1 is not working. mycontroller1's name and mycontroller2's name are different. But only works below line as correctly. Why?
[eluser]Fatih[/eluser]
It is fixed. I found this thread. Also, I added some codes into my controllers as given below: Code: function _remap($method) { Then I remove these codes "route['bla bla']" from my route.php. Everything are fine now. |
Welcome Guest, Not a member yet? Register Sign In |