1

I've read these pages regarding this:

http://philsturgeon.co.uk/blog/2009/07/Create-an-Admin-panel-with-CodeIgniter

Separate Admin and Front in codeigniter (look at answer by Madmartigan)

their both good approaches but I'm not sure if that is what I'm looking for.

I want to separate the front-end from the back-end I was thinking of a layout like this: (view image) I am about to convert large web applications to CI and to keep everything as organized as possible i figured this folder layout would be the best approach but since im a newbie to CI would you consider this layout? I have attempted this layout already as a test and I would run into problems since the directory is named back-end or front-end so when I would type say:

http://example.com/backend/mycontroller/mymethod I would reach a 404 page. 

enter image description here

1 Answer 1

0

I was looking into this last week, for a small project I was setting up (in the end I went with Kohana 2.3.4, but never mind :P)

The best file system I came up with for CodeIgniter is this:

/ application
/ - /admin
/ - - /config
/ - - /controllers
/ - - /models
/ - - /views
/ - /public
/ - - /config
/ - - /controllers
/ - - /models
/ - - /views
/ core
/ - /all the core stuff
/ public_html
/ - /admin
/ - - index.php
/ - index.php

The problem here is there's no code-sharing going on between the two, so you can't re-use any stuff - if you're OK with that (probably not good for a large application), this should probably do what you want.

If switching to Kohana is an option, give me a shout and I'll post my structure for that - it's similar to this, but has an extra level where I the front-end and back-end can share code, while still using their specific code as a priority. It's much nicer for anything bigger than a small application :)

Sign up to request clarification or add additional context in comments.

4 Comments

i like your layout more than mine. did you make public_html the root for the domain?
Yep, and the index.php files just point all the roots to ../ followed by whatever they need to be (or ../../ for the admin one). Keeps the application files outside of the webroot
btw, rather than doing ../ try something like this , this is my example that i use define('DOCUMENT_ROOT', str_replace('/public', '', $_SERVER['DOCUMENT_ROOT']));
No point, you only put it in the config paths to tell the bootstrap where to look for your application. Once it knows that, the framework adjusts the paths for you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.