Jeff B.
Jeff B.

Reputation: 1167

CodeIgniter 2 not allowing multiple level subfolders for controllers

As I read the doc, controllers in CodeIgniter are supposed to support multiple level subfolders, but as far as I have tested, it is impossible to work after first a first level folder.

By example:

mysite.dev/ (index page, default controller home.php, works)

mysite.dev/admin/ (admin section, in admin/home.php, works)

mysite.dev/admin/manage/ (in admin/manage/home.php, do not work)

I am trying to know why and how to make it work on multiple level sub folders?

Thanks in advance!

Upvotes: 4

Views: 3594

Answers (1)

manix
manix

Reputation: 14747

CI only allows one sub-dir level. However, you can emulate this pattern with routes file as @Brendan says:

Controllers:

welcome.php
admin/admin.php
admin/manage.php

Routes file:

$route['admin/manage/:any'] = "admin/manage/$1";
$route['admin/admin'] = 'admin/home.php';

You can implement some changes to the hardcode to get works as expected: http://codeigniter.com/forums/viewthread/190563/

Upvotes: 3

Related Questions