Welcome Guest, Not a member yet? Register   Sign In
How to create admin panel
#3

[eluser]InsiteFX[/eluser]
application/config/routes.php
Code:
//                    dir/controller/method
$route['login']    = "admin/admin/login";
$route['logout']   = "admin/admin/logout";
$route['register'] = "admin/admin/register";

controllers
  -- admin
  ---- admin.php - extended from Admin_Controller, login is the admin/method which will display the view file.
  ---- users.php - extended from Admin_Controller, for managing users

Code:
// these go into application/core
// NOTE: The class name doe's not have to be MY_Controller but the file has to be saved as MY_Controller.php

class MY_Controller extends CI_Controller {}

class Admin_Controller extends MY_Controller {}

class Public_Controller extends MY_Controller {}

// these go into application/controllers/admin - and would be used for a dashboard and managing users.
class Admin extends Admin_Controller {}
class Users extends Admin_Controller {}

// rest would be application/controlers for Public Controllers
class Main extends Public_Controller {}

Code:
// add this to the bottom of - application/config/config.php
/*
| -------------------------------------------------------------------
|  Native Autoload - by Phil Sturgeon. NOTE: A New Version!
| -------------------------------------------------------------------
|
| Nothing to do with config/autoload.php, this allows PHP autoload to work
| for base controllers and some third-party libraries.
|
| If using HMVC you do not need this! HMVC will SPL_Autoload.
|
| Place this code at the bottom of your application/config/config.php file.
*/
function __autoload($class)
{
    if (strpos($class, 'CI_') !== 0)
    {
        if (file_exists($file = APPPATH . 'core/' . $class . EXT))
        {
            include $file;
        }
        elseif (file_exists($file = APPPATH . 'libraries/' . $class . EXT))
        {
            include $file;
        }
    }
}

InsiteFX


Messages In This Thread
How to create admin panel - by El Forum - 05-23-2011, 05:53 AM
How to create admin panel - by El Forum - 05-24-2011, 05:34 AM
How to create admin panel - by El Forum - 05-24-2011, 06:21 AM
How to create admin panel - by El Forum - 05-24-2011, 11:43 PM
How to create admin panel - by El Forum - 05-25-2011, 01:32 AM
How to create admin panel - by El Forum - 05-25-2011, 02:55 AM
How to create admin panel - by El Forum - 05-25-2011, 03:17 AM
How to create admin panel - by El Forum - 05-25-2011, 03:22 AM
How to create admin panel - by El Forum - 05-25-2011, 03:40 AM
How to create admin panel - by El Forum - 05-25-2011, 04:08 AM
How to create admin panel - by El Forum - 05-25-2011, 04:16 AM
How to create admin panel - by El Forum - 05-25-2011, 04:26 AM
How to create admin panel - by El Forum - 05-25-2011, 04:31 AM
How to create admin panel - by El Forum - 05-25-2011, 04:37 AM
How to create admin panel - by El Forum - 05-25-2011, 10:08 PM
How to create admin panel - by El Forum - 05-26-2011, 01:15 AM
How to create admin panel - by El Forum - 05-30-2011, 12:53 AM
How to create admin panel - by El Forum - 05-30-2011, 12:57 AM
How to create admin panel - by El Forum - 05-30-2011, 01:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB