CodeIgniter Forums
back-end and front-end separation - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: back-end and front-end separation (/thread-6586.html)

Pages: 1 2


back-end and front-end separation - El Forum - 03-04-2008

[eluser]steelaz[/eluser]
Right now I have two separate directories:

system/admin
system/application

And in 'public_html' two files to call them:

public_html/admin/index.php
public_html/index.php


How do you separate your front-end from back-end? Or do you prefer to keep them together?


back-end and front-end separation - El Forum - 03-04-2008

[eluser]exodus7[/eluser]
What I do is create a controller named admin and put my functions like login, logout, addPost, editPost, etc, and use the session class to verify permissions before loading a view.


back-end and front-end separation - El Forum - 03-04-2008

[eluser]Majd Taby[/eluser]
the way CodeExtinguisher works is by putting everything it uses in a folder outside of system/...it never made sense to me to have the application inside the system folder.


back-end and front-end separation - El Forum - 03-05-2008

[eluser]Phil Sturgeon[/eluser]
Well there are two options really.

Two Applications
Have two applications totally seperate, this means they have nothing in common. Seperate login, seperate models, seperate libraries, etc. That may be useful, depending on what sort of backend you have, as you may have loads of huge big functions and libs that frontend users will never need, or you may not have the same login for both admins and users.


Admin Sub-Directory
If you will need to use lots of similar data/files between both the admin and frontend, it makes sense to just have the admin in a sub directory and use all the same stuff. I normally do it this way as my sites are often basic "user registration/forum/blog" type sites with a few extras. No need to seperate it.


back-end and front-end separation - El Forum - 03-05-2008

[eluser]adamp1[/eluser]
I keep mine separate by use of admin directly and an Admin and Public Controller. The only different is the Admin controller asks for authentication.


back-end and front-end separation - El Forum - 03-05-2008

[eluser]steelaz[/eluser]
@jTaby: Now that you mentioned it, it makes logical sense to put an application outside system folder, but does it give you any other benefits besides having things "neat"?


back-end and front-end separation - El Forum - 03-05-2008

[eluser]Pascal Kriete[/eluser]
It means that you can run several applications with only one system folder, which cuts down on the clutter and makes it really easy to update.


back-end and front-end separation - El Forum - 03-05-2008

[eluser]zdknudsen[/eluser]
You could also use two applications (as the pyromaniac) suggest, together with Matchbox, and have a module directory in your system folder with resources that are to be shared between the two, and then additional module directories in each application folder with resources exclusive to front/back-end.


back-end and front-end separation - El Forum - 03-05-2008

[eluser]esra[/eluser]
[quote author="Zacharias Knudsen" date="1204760234"]You could also use two applications (as the pyromaniac) suggest, together with Matchbox, and have a module directory in your system folder with resources that are to be shared between the two, and then additional module directories in each application folder with resources exclusive to front/back-end.[/quote]

In the case of Matchbox, could you not modify MY_Router to conditionally load a module from application/admin/modules/ when 'admin' was included as the first segment in the url? You could probably enable this as a feature via a config setting. The advantage would be sharing common libraries, helpers, and plugins within a single application rather than creating two applications. The disadvantage, especially when a module installer is considered, is dividing module specific code among two module directory system.

Code:
application/
application/admin/modules/
application/config/
application/controllers/
application/helpers/
application/hooks/
application/language/
application/models/
application/modules/
application/plugins/
application/views/

In our earlier projects at work, we use the pyromaniac approach but rename a second copy of index.php to admin.php in order to load the two applications.


back-end and front-end separation - El Forum - 04-21-2008

[eluser]dejitaru[/eluser]
When I work on my localhost I have this folders:
D:\proyects\proyect1\
-frontend
-backend
-system
-www
--index.php
--admin
---index.php

D:\proyects\proyect2\
-frontend
-backend
-system
-www
--index.php
--admin
---index.php
Then in the first index.php I have:
$system_folder = "../system";
$application_folder = "../frontend";

..And in admin/index.php I have:
$system_folder = "../../system";
$application_folder = "../../backend";

This way when I upload my files to the server I put frontend,backend and system outside the public_html and the contents of www goes into public_html