3

hello i was wondering how can i put my components and models in sub sub directories, lets say i have a web application that have 3 different areas (admins, users, developers) each one of them performs different actions and have a whole different interface, so i want the the admin to go to http://www.site.com/admin etc.

i have tried different soultions but none worked for me, can any one provide me with an example of how to do it.

am using CakePHP 2.1.1

Thanks in advance

2

3 Answers 3

8

Yes, you can do this using App::build(). All it does is tell Cake where to find models, controllers, etc.

App::build(array('Model' => array('/a/full/path/to/models/')));

Now Cake will look for anything using the Model package in /a/full/path/to/models/.

Better yet, there's a plugin that does this for you automatically: https://github.com/ichikaway/AutoAppBuild

Now while this answers the original question, I think you might want to look into Routing prefixes as a better solution to your problem.

Sign up to request clarification or add additional context in comments.

Comments

2

If you want to have three different interface for each role you can create three different layout and call them based on the role. Accessibility wise you can setup acl component and give authorization to the modules based on the role.

Comments

0

controller subdir way is no longer possible. And it is removed from latest version of cakephp. On the other hand you can use plugins instead of this. deizel is right you can follow what he said.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.