Welcome Guest, Not a member yet? Register   Sign In
Help needed w/ routing
#1

[eluser]Unknown[/eluser]
I'm new to CI and am creating a web app that will utilize custom URLs to determine what data to display. For example, the URL scheme looks something like this, or a hierarchical alternative of this:
Quote:www.website.com/grandparent/parent/child
I have a controller called "feed" which I would like to handle those dynamic URLs, but I also have a controller called "user" which handles user registration, login, settings, etc.

Quote:User registration/login/settings: www.website.com/user/[function]
Everything else is a "feed": www.website.com/grandparent/parent/child

Doing $route[':any'] = "feed"; obviously results in breaking the registration and login as contained in the "user" controller.

How can I establish a route that routes everything to the "feed" controller, but does not change the route of requests to the "user" controller?
#2

[eluser]Eric Barnes[/eluser]
I believe the order of routes is important. So in your case something like this:
Code:
$route['user/(:any)'] = "user/$1";
$route['(:any)'] = "feed";
$route['(:any)/(:any)'] = "feed/$1";
$route['(:any)/(:any)/(:any)'] = "feed/$1/$2";
#3

[eluser]Unknown[/eluser]
Looks like it's working now! Thanks Eric!
#4

[eluser]Eric Barnes[/eluser]
Glad to help my friend.




Theme © iAndrew 2016 - Forum software by © MyBB