i have created the front of the website by baking the MVC and done the coding also, at that time i haven't backed the admin section.
Now i want to add admin section.which is the best method to do it.
i have created the front of the website by baking the MVC and done the coding also, at that time i haven't backed the admin section.
Now i want to add admin section.which is the best method to do it.
I am running thru the same issue as you. I have create several controllers (articles, users, fotos, etc), but now I have the need to create an admin section before moving forward. After asking questions here, reading the cookbook and doing some research online this is what I think is the best approach:
control panel controller
or whatever you want to call it, where you can have an action called admin_index
or admin_display
. This action should act like the home.ctp from the pages controller. Just use admin action so all other users should are denied access to this controller. I would have things there like, latest comments, latest users, visits graphs, comments needing approval, etc. This is an example on how to approach this.Routing.prefixes
in your core.php
file. (You can find instructions about this in the CakePHP cookbook)admin_index, admin_add
admin
is redirected to the control panel controller
on loginadmin layout
and make sure the control panel controller
and all admin actions
use this layout. In this layout you should create a menu that links to all admin actions
somewhere in the header and underneath you should have a section where all admin action will be displayed. Theme Forest should have some good control panel examples you can use. I will be working in my admin system sometime this weekend and If I am successful using this approach I will post the code back in here.
To note: I am also learning CakePHP and although I love it, I can still make beginners mistakes. One thing I would suggest you dont do is start using plugins this early in your game. It will discourage you and sink any hope you have in being successful programming in Cake
The best method would be to create your own admin panel, however it would be time consuming at time you can also try out a cakephp plugin and looking at the inner coding learn how it is done.
You can give a try with https://github.com/Maldicore/Admin
You can write yours by using tutorial or you can use one of the existing. If you write yourself Auth component must be implemented as a minimum requirement.