0

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?

Walter
  • 16,158
  • 8
  • 58
  • 95
shaheer
  • 103
  • 3

1 Answers1

0

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.

Andrea
  • 5,355
  • 4
  • 31
  • 36
  • the problem is the client wants an admin section like wordpress. – shaheer Jun 03 '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 04 '11 at 13:20
  • i did what you said, lets see what my client says... – shaheer Jun 05 '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 06 '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 09 '11 at 19:40