CodeIgniter Forums
How to create Admin panel folder? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: How to create Admin panel folder? (/thread-24290.html)

Pages: 1 2


How to create Admin panel folder? - El Forum - 11-05-2009

[eluser]web_developer[/eluser]
Hello,

Here is my directory structure..

/system/application/controllers/admin/login.php <--- Admin Directory
/system/application/controllers/home.php <--- Default Home page

http://www.test.com <-- Home page is working fine..
http://www.test.com/admin <--- Admin is not working.

Because in route default home page can come easily
but how to route admin panel?

Please explain the steps in easiest way.

Thanks


How to create Admin panel folder? - El Forum - 11-05-2009

[eluser]iFadey[/eluser]
You need to understand how CodeIgniter's URLs work. Better read this:

http://ellislab.com/codeigniter/user-guide/general/urls.html

Your login URL is not test.com/admin. Actually it's test.com/admin/login


How to create Admin panel folder? - El Forum - 11-05-2009

[eluser]stommert[/eluser]
add

$route['admin'] = "admin/login";

to your routes.php in the config directory of your application.


How to create Admin panel folder? - El Forum - 11-05-2009

[eluser]web_developer[/eluser]
Already tried that way.. But not working..

admin/login <-- It is considering "admin" as a class and loging as a function.


How to create Admin panel folder? - El Forum - 11-05-2009

[eluser]Phil Sturgeon[/eluser]
If you put that as a route then you are screwed past login, as all requests directly to admin will force a login.

Sub-folders are a pain in the ass for admin panels. Check out this article on the topic to see the advantages and disadvantages of each method.


How to create Admin panel folder? - El Forum - 11-05-2009

[eluser]web_developer[/eluser]
hmm then what should do?
I want to keep admin file seperately...
OR
I have to do mix admin files with frontend?

Which is the good way?


How to create Admin panel folder? - El Forum - 11-05-2009

[eluser]Phil Sturgeon[/eluser]
The whole point is there are many ways to do it, and that article explains them all.

You don't HAVE to do anything. I prefer to keep my files grouped in a modular way, meaning everything to do with a blog is in a "blog" module. That means frontend, backend (admin) etc is all in the same place.

You CAN use sub-folders, but it gets messy as your app grows. It's all on Google buddy. :-)


How to create Admin panel folder? - El Forum - 11-05-2009

[eluser]web_developer[/eluser]
if I create Frotend and Backend seperately then every thing will become double.

2 config directory,
2 library.

--&gt; I have to define 2 times DB settings. (For Frontend and for Admin)
--&gt; I can't use my common function in admin as well as frontend. I have to declare in both library.

This is not the good way.


How to create Admin panel folder? - El Forum - 11-05-2009

[eluser]Phil Sturgeon[/eluser]
Which is exactly what the article says. Read the whole thing. ;-)


How to create Admin panel folder? - El Forum - 11-05-2009

[eluser]eokorie[/eluser]
I have actually been using a separate frontend and backend for the CMS i am currently working on. Definitely is a bit of a pain in the back side so I am going to consider changing things a bit myself.