Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 2.0.x - Controller subdirectories - Default controller needs to be in URL
#1

[eluser]Unknown[/eluser]
I started a discussion over at stackoverflow (http://stackoverflow.com/questions/81439...s-to-be-in) a couple ddays ago but it probably makes sense to see what the actual CodeIgniter community has to say.

Since upgrading to 2.0.3 (now on 2.1) I thought it might be nice to clean up my controllers and start using subfolders (http://ellislab.com/codeigniter/user-gui...subfolders). Only I can't seem to get it to work. My old controller setup was...

Code:
/[app folder]/controllers/base.php
/[app folder]/controllers/about.php
/[app folder]/controllers/contact.php
/[app folder]/controllers/products.php
etc.

What I'm trying to do now is:

Code:
/[app folder]/controllers/base.php
/[app folder]/controllers/about/base.php
/[app folder]/controllers/about/social_responsibility.php
/[app folder]/controllers/contact.php
/[app folder]/controllers/products.php
etc.

Where the old about page is contained in its own base.php file. And the new "social responsibility" sub section and all its pages go into the second file. I've tried multiple variations on routes and as I understood what I read on the controllers page and what I've read on other posts the "base" default controller should carry over. But the only way to get at the pages is to use /about/base/whatever. If you simply put about/whatever you get a 404.

The guys at stackoverflow suggested using:
Code:
$route['about/(:any)'] = "about/base/$1
But that breaks all the pages in social responsibility.

I get the feeling I'm misunderstanding something fundamental. Because the only way I can think to get around this is using something like regular expressions... Only from what I'm reading this should work and doing that would be overkill. Does anyone have any clues? Here are my current routes:

Code:
$route['default_controller'] = "base";
$route['404_override'] = '';

$route['about'] = "about/base";

Thanks in advance!




Theme © iAndrew 2016 - Forum software by © MyBB