Welcome Guest, Not a member yet? Register   Sign In
Retrieve controller namd and function name from url
#16

[eluser]CroNiX[/eluser]
I understand your question just fine. Why you want to do it this way is what I don't understand. There just isn't anything that will do what you want, unless your app stays exactly the same as it is.

You can keep doing what you are doing, however if your app changes and you add a subdirectory to your controller directory (like you want all admin controllers in an admin directory for separation), or you start using routes, your method will no longer work as you can remove controller names and method names from the url to provide neater urls. However, I would make it more robust and actually check if $segments[0] is an actual file that exists in /application/controllers before assuming it is correct and trying to use it (unless all of your urls will always start with controller/method and it will never deviate from that).

I think you should rethink your approach as it's not very scalable and has more overhead.


Messages In This Thread
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:13 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:18 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:27 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:34 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:37 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:39 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:41 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:43 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:43 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:49 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:49 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:53 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:54 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:55 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 03:55 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 04:06 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 04:07 PM
Retrieve controller namd and function name from url - by El Forum - 04-16-2012, 04:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB