CodeIgniter Forums
codeigniter admin part - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: codeigniter admin part (/showthread.php?tid=33560)



codeigniter admin part - El Forum - 08-31-2010

[eluser]revanth[/eluser]
Hi i am new to codeigniter and i have developed the frontend for my project through the database and i want to build the backend for that one plz any one tell me how to build the admin area for this one i have searched for google but i didn't got any correct information


codeigniter admin part - El Forum - 08-31-2010

[eluser]pickupman[/eluser]
Congrats on getting started with CI. When I first started with CI, I found myself creating rather large admin controllers to handle each part of the apps. Those site still work fine. That's one approach. Lately, I have been using Modular Separation from Phil Sturgeon for both front and back end. This creates a modules folder in the /application folder. Now each section of the frontend has it's own set of controllers/models/libraries/views.

Then I have something like
/application
/controllers
admin.php
/modules
/pages
/controllers
pages.php
admin_pages.php
/profiles
/controllers
profiles.php
admin_profiles.php
...rest of folders

This allows to create a admin module for my frontend controller. I use routes like
Code:
$route['admin/([a-zA-Z_-]+)/(:any)'] = '$1/admin_$1/$2';
$route['admin/([a-zA-Z_-]+)'] = '$1/admin_$1/index';
$route['admin/(:any)']        = 'admin/$1';
$route['admin']               = 'admin/index';

Links like /admin/pages/index loads 'pages/admin_pages/index'. The main admin controller in the /controllers folder has one index method and is the admin dashboard usually with latest info like comments, searches, users, etc.

This is a little verbose, but Modular Separation has helped organize my helps much better than before.