Welcome Guest, Not a member yet? Register   Sign In
any way to auto-route to a directory under controller?
#11

[eluser]theprodigy[/eluser]
Quote:So I guess if one is not going to reference an expression as an input on a route, it’s an error to use parentheses around it?

Not sure why that is. Maybe it's a bug, maybe it's CI saying "don't make me remember more than I actually have to". :lol:

Either way, Glad you got it worked out.
#12

[eluser]Chillahan[/eluser]
Thanks man, really appreciate your assistance again, I never would have thought to try it that way!
#13

[eluser]Unknown[/eluser]
For anyone else that stumbled upon this looking for a way to completely reroute all of the requests to a controller (including parameters) without doing the crazy long list if route definitions, you can do this:
Code:
$route['controller_name\/?(:any)*'] = 'sub_folder/controller_name/$1';
#14

[eluser]Unknown[/eluser]
Hello everyone. I'm trying to the randomly search the user profile in the site root http://www.example.com/username and I put it like this:

Code:
$route['(:any)'] = 'users/view/$1';

But elsewhere I need another subdirectory is well http://www.example.com/search/users or http://www.example.com/search/tags I'm doing this:

Code:
$route['search'] = 'search';
$route['search/(:any)'] = 'search/view/$1';

but when accessing this url (http://www.example.com/search/users) I'm falling in controller of the user profile.

What am I doing wrong?

Thanks a lot
#15

[eluser]Pert[/eluser]
[quote author="lcosouza" date="1370724227"]Hello everyone. I'm trying to the randomly search the user profile in the site root http://www.example.com/username and I put it like this:

Code:
$route['(:any)'] = 'users/view/$1';

But elsewhere I need another subdirectory is well http://www.example.com/search/users or http://www.example.com/search/tags I'm doing this:

Code:
$route['search'] = 'search';
$route['search/(:any)'] = 'search/view/$1';

but when accessing this url (http://www.example.com/search/users) I'm falling in controller of the user profile.

What am I doing wrong?

Thanks a lot[/quote]

You could try switching the statements around in routes.php file. Not sure if it will fix your issue, but worth giving a try.




Theme © iAndrew 2016 - Forum software by © MyBB