How to create admin panel |
[eluser]JasmineFlower[/eluser]
Hi, I am using codeigniter 2.0.1 version. Here is my directory structure.. /application/controllers/home.php (Default Home page) /application/controllers/admin/login.php (Admin Directory) http://localhost/projectfoldername - Home page is working fine.. http://localhost/projectfoldername/admin - Admin is not working. Because in route default home page can come easily but how to route admin page? $route['admin']='admin/login/index'; but it considered admin as class and login as function it display the 404 error. pls tell me how to route the admin folder
[eluser]CrossMotion[/eluser]
Hi Jasmine_flower, Make sure you don't have a admin.php file in the controllers folder, because it will overwrite the admin folder. And check if there are no conflicting rules in the route file.
[eluser]InsiteFX[/eluser]
application/config/routes.php Code: // dir/controller/method Code: // these go into application/core Code: // add this to the bottom of - application/config/config.php InsiteFX
[eluser]JasmineFlower[/eluser]
Hi, thanks for your reply.. I followed your instructions. I typed the url manually in the address bar like http://localhost/projectfolder name/admin, but the same error - Object not found - displayed. I don't know what mistake i did. my folder structure is now application/controllers/admin/admin.php - for Admin application/controllers/home.php - for user can you please explain me
[eluser]CrossMotion[/eluser]
As far as I know, simple things as these don't require extending core classes and such. Just adding a route should be enough. Can you post the code of your /controllers/admin/login.php controller and the routes you're currently using, to check if there might be something wrong there.
[eluser]JasmineFlower[/eluser]
Hi, My folder Structure project folder name/application/controllers/admin folder/admin.php - for Admin project folder name/application/controllers/home.php - for user My route.php Code: $route['default_controller'] = "home"; my controller admin.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); my user controller page home.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]CrossMotion[/eluser]
Just change Code: class Admin extends Admin_Controller Code: class Admin extends CI_Controller
[eluser]JasmineFlower[/eluser]
I already tried it but still in that same error. What about the .htaccess file ?
[eluser]CrossMotion[/eluser]
If you use the default htaccess file it should not be a problem. If you changed it, can you post it here? Do you get a 404 error, or a php error? if its PHP, can you post it here to. Also if you need the url helper in the login function, you need to put it in a __construct, like this: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]InsiteFX[/eluser]
I would autoload the url helper because it is used so much! InsiteFX |
Welcome Guest, Not a member yet? Register Sign In |