Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am writing an admin panel in cakephp

I got a question the panel will have the functionality to add items to the main website (images specifically) so I am wondering if I should put all the functionality (add,edit,view,delete) to the main admin controller or should I make a different controller for that? As the admin panel will most likely be extended with more features such as adding new users, modifying them etc.

What do you recommend?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I would use a different controller for different items. Actually, I would not even have a separate admin controller: I would put some admin actions inside each controller.

Controllers in CakePHP are divided by the objects they act upon, not by the identity of the person who is diong the action.

share|improve this answer
    
the problem is the client wants an admin section like wordpress. –  shaheer Jun 3 '11 at 16:08
    
Yes, that is common: all sites but the simplest have an admin section. Nevertheless, the usual way to group the actions in CakePHP is per model, not per user identity. You can have the admin actions split through the various controllers, just like the usual actions. Think it like this: do you group all the actions for a normal user in a single controller? –  Andrea Jun 4 '11 at 13:20
    
i did what you said, lets see what my client says... –  shaheer Jun 5 '11 at 14:43
    
Your client should not see anything in particular (unless he is a programmer and looks at the source). The advice I gave you is only about the internal organization of the code. If not, there must have been a misunderstanding, and I apologize for it. –  Andrea Jun 6 '11 at 23:36
    
hey i used your solution and it works the best! thankyou so much it helps me a lot in managing my source code and keeping everything lightweight, you are the man :p –  shaheer Jun 9 '11 at 19:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.