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

[eluser]Kitsched[/eluser]
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!
#2

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

Code:
//Controller

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.
#3

[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.
#4

[eluser]Linderman[/eluser]
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/page.php
/application/views/header.php
/application/views/footer.php
/application/views/index.php
/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

/application/views/admin/page.php
/application/views/admin/header.php
/application/views/admin/footer.php
/application/views/admin/dashboard.php
/application/views/admin/infopages/index.php
/application/views/admin/infopages/add_edit.php
... 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..
#5

[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!
#6

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

I ment Frontend ... why its not good?
#7

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

[eluser]rawoke083[/eluser]
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
http://ellislab.com/forums/viewthread/181990/




Theme © iAndrew 2016 - Forum software by © MyBB