Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

controllers in sub folders #645

Closed
hufersil opened this Issue Sep 17, 2012 · 2 comments

Comments

Projects
None yet
3 participants

There's a way to loading controllers in a sub folder without creating an specific route to them?

Example:

Route: http://mysite/home/index
Route (in a sub folder): http://mysite/admin/home/index

Note: I'll have the same name of controllers inside both paths:

/www/client/app/controllers/HomeController
/www/client/app/admin/controllers/HomeController

thanks in advance

Contributor

mehlah commented Sep 17, 2012

Checkout this answer on SO: http://stackoverflow.com/questions/12288416/change-default-controller-path-in-lithium
And take a look in the docs to Dispatcher rules.

    //Overrides the controller default path whenever the `admin` flag is encountered in parameters returned from routing
    Dispatcher::config(array('rules' => array(
      'admin' => array('controller' => 'app\controllers\admin\{:controller}Controller')
    )));

    //Continuation route for admin requests
    Router::connect('/admin/{:args}', array('admin' => true), array(
      'continue' => true, 'persist' => array('controller', 'admin')
    ));

thank you very much!

@nateabele nateabele closed this Sep 18, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment