Welcome Guest, Not a member yet? Register   Sign In
Best practices for implementing a site's administration

I was just wondering how everyone is doing it or how do you think it should be done?

For now, my idea is to have two separate CI installations: one for the main application / site and one residing in /cp or /admin which is the administration area.

If this has been asked before please hit me with the link.

Thank you!

[eluser]Thorpe Obazee[/eluser]
Some people handle it like this:


Class Test extends Controller() {
    function admin_posts()
        // do stuff

    function posts()
        // do stuff


Some do it by creating an admin folder and putting administration controllers inside. Some (few) create separate installations for managing the back-end and front-end. It really depends on what your application needs and what feels natural for you.

[eluser]Phil Sturgeon[/eluser]
There are many ways to do this. I wrote up an article showing a few ways which are probably more flexible than the solution above.

You want to avoid having MAHUSIVE CONTROLLERS THAT DO EVERYTHING by splitting them up into logical chunks. Frontend and Backend should not be in the same file as they share no logic.

In these situations i feel comfortable to do the following:

/application/libraries/MY_Controller.php which Extends Controller

/application/controllers/Fronfend.php which extends MY_Controller

/application/controllers/Infopages.php which extends Frontend
/application/controllers/Gallery.php which extends Frontend
/application/controllers/News.php which extends Frontend
... and so on

for admin:

/application/admin/Admin.php which extends MY_Controller
/application/admin/Infopages.php (adding, editing ...) which extends Admin
/application/admin/Gallery.php (adding, editing ...) which extends Admin
/application/admin/News.php (adding, editing ...) which extends Admin
... and so on

Then in the view:

/application/views/infopages/index.php (for example when viewing all the pages into a list)
/application/views/infopages/show.php ( when viewing specific infopage, like about us for example)
/application/views/gallery/index.php ( viewing all the gallery categories )
/application/views/gallery/show.php ( when in particular gallery category -> seeing images in it )
... and so on

... and so on

Maybe its not the best way , but i feel comfortable in this logic.

It will be great really if some more information on Method #3 from this article: http://philsturgeon.co.uk/news/2009/07/C...odeIgniter

i mean exact examples of configuration, inheritance and url calling..

[eluser]Phil Sturgeon[/eluser]
Fronfend.php? That won't go well.

Using base controllers is a very good method yes, I do it in every application and can't bare to be without them!

[quote author="Phil Sturgeon" date="1271346609"]Fronfend.php? That won't go well.[/quote]

I ment Frontend ... why its not good?

[eluser]Phil Sturgeon[/eluser]
[insert smilie face here]

Hi I did something similar
I usually have site.com and then admin.site.com

It does require you to edit codeignitor 3 files 10 lines plus minus in total Big Grin

Theme © iAndrew 2016 - Forum software by © MyBB