Best place to put the admin part |
[eluser]freshface[/eluser]
Hey I am building a website but I was wondering where to place the admin part? I have all my controllers to handle the front of my website but want to keep my structure clean. Is it possible to create a folder "admin" in controllers and place all the admin stuff there? Thx in advance.
[eluser]Pascal Kriete[/eluser]
Just try it . Yes, you can put a subfolder in your controllers directory - it will then become part of the url: http://example.com/folder/controller/function/params You cannot nest subfolders though.
[eluser]freshface[/eluser]
Great, will try it out. I Maybe thought you guys use some other elegant/flexible solution?
[eluser]internut[/eluser]
[quote author="inparo" date="1216320511"]Just try it . Yes, you can put a subfolder in your controllers directory - it will then become part of the url: http://example.com/folder/controller/function/params You cannot nest subfolders though.[/quote] This would change segment URI values correct? I'm building an app where there is a frontend and backend. I have a /admin/ folder for controllers & views. Wonder if this is the best way to go. I started going the direction of two /application/ folders. In that case you would have two sets of config files, db config, etc. and would have to duplicate libraries. Thoughts?
[eluser]freshface[/eluser]
I did it like this: http://codeigniter.com/wiki/Modular_Extensions_-_FAQ/ it is just the greatest solution.
[eluser]internut[/eluser]
i started going in this direction but did not like that there will be a second set of config & db setup to be done? As well as possibly duplicate libraries to run on both front end and back-end? Am I wrong?
[eluser]freshface[/eluser]
You run one system and different applicitions with its own libraries and setup. That is what I like about it, the sepperation of applications. The db config file of my frontend is different from my backend (i use db caching). And the libs I use are created for the front- or the backend part. It is a personal choice.
[eluser]internut[/eluser]
i like the idea but not trying to have multiple configs for the same DB setup. Do not believe i've set anything up to date where I had to plugin MySQL database details twice.
[eluser]freshface[/eluser]
Maybe you can figure something out to use one config folder/file? I dont mind to fill out the some file twice, it us just copy/paste and edit some settings. I love the seperation, when I am working on the frontend part i can not harm the backend and otherwise.
[eluser]internut[/eluser]
Yeah i thought about maybe somehow having config file located once and called but not sure how CI would like that or allow it. I'm toying with splitting up the controller & views: controllers/ admin/ controller.php views/ /admin/ controller_view.php And adding into the URL the /admin/ folder name. So i get in the end: .com/program/ (which runs the front end) .com/program/admin/ <--- which calls the controller in the /admin/ folder. Just have to alter my URI Seg calls and put /admin/ in my links. Which still breaks up front versus backend controllers & views and I can have one set of libraries, config, db config, etc. |
Welcome Guest, Not a member yet? Register Sign In |