Welcome Guest, Not a member yet? Register   Sign In
Help creating a route for sub-folder holding controllers
#1

(This post was last modified: 10-07-2015, 11:31 AM by jLinux.)

In my CI application, all of the administrative actions are in controllers within the /controllers/admin/ folder....

Quote:[root@server application]# tree controllers/
controllers/
|-- Account.php
|-- Api.php
|-- Assets.php
|-- Dashboard.php
|-- Group.php
|-- Help.php
|-- Main.php
|-- Page.php
|-- Partition.php
|-- REST
| |-- Account.php
| |-- Admin.php
| |-- Analytics.php
| |-- App.php
| |-- Assets.php
| |-- Key.php
| |-- Page.php
| `-- Partition.php
|-- admin
| |-- Accounts.php
| |-- Backups.php
| |-- Groups.php
| |-- Home.php
| |-- Logs.php
| |-- Pages.php
| |-- Partitions.php
| |-- Plugins.php
| |-- Recyclebin.php
| |-- Roles.php
| |-- Settings.php
| `-- Support.php
`-- index.html

The question I had was how can I have it so when they go to application.com/admin/, it shows a resource in a specified controller?

I tried adding the following to application/config/routes.php, but it didn't work:
PHP Code:
$route['admin'] = '/admin/home'
I tried it with/without the slash after admin, as well as with/without slashes before/after the admin/home didn't work.

Obviously creating an Admin.php inside the application/controllers/ directory would work for the /admin/ index, but make all the controllers inside the application/controllers/admin/ inaccessible.

Thanks!
Reply


Messages In This Thread
Help creating a route for sub-folder holding controllers - by jLinux - 10-07-2015, 11:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB