Welcome Guest, Not a member yet? Register   Sign In
best practice to setup admin controller?
#1

[eluser]snoo[/eluser]
Hello guys,

I'm setting up my admin controller and is a little bit confused on how to structure my files.

I want my url to be as such:

blog entries: /admin/blogs
static page: /admin/pages
menu: /admin/menu
etc

Am I limited to putting all my page controls into my admin class as functions? Or is it possible to actually make a blog controller, or a static page controller, in admin folder, inside my controller?

thanks much for any pointer.
#2

[eluser]CroNiX[/eluser]
Yes, create a folder in /application/controllers, like /application/controllers/admin
Put all of your admin controllers in there.
create a default route, so if they enter /admin (which is just a folder) it will take them to a specific controller. This would normally be a dashboard or something.

Code:
$route['admin'] = 'admin/controller/method';

I would also look into base classes, so you can create an admin_controller, which does things like check for auth, etc. Then all other admin controllers would extend the Admin_controller instead of CI_Controller.

Here's a good article to read on that.
#3

[eluser]snoo[/eluser]
great! I will give that a try. thank you very much.
#4

[eluser]vbsaltydog[/eluser]
You should have your admin controllers extend MY_Controller and put your authentication in MY_Controller so you can keep your code DRY.




Theme © iAndrew 2016 - Forum software by © MyBB