Welcome Guest, Not a member yet? Register   Sign In
How to retrieve a variable from URL before the controller?

My application will run for several users. So for instance, I have the controller bike. I can view/add/delete/update bikes by accessing the URLs:


Now, I want each user can access this controller by these URLs:



I know that my whole application will always be accessed by a context (/user/). But I don't know what more segments I'll have on my URI. How can I get this variable?

I was thinking in using routes, but I'm not sure it'd work or if it's the best solution:

$route[':any/(:any)'] = '$1';
$route[':any'] = $route['default_controller'];

$context = $this->uri->segment(1, 'default_context');

Is this the best solution?


Edited my first post.

You could give a look to "Hooks" in the user guide:


Hope it helps.


[quote author="xwero" date="1236557074"]http://ellislab.com/forums/viewreply/543955/[/quote]

Ok, good, it's the same solution I came up. Guess it's the way to do it. Wink


Theme © iAndrew 2016 - Forum software by © MyBB