• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can you tell me mindmapping for admin view and public view for my site?

#1
[eluser]ytsejam[/eluser]
Hello ,
I am a novice coder. Until now I could make my website controlled by MY_Controller.php and can get content from mysql . Now i need one more thing which I have to add admin controller so that admin can edit the content of the page. basically admin and public views will be same but only edit page will be added.

This is how I started MY_Controller.php .
Code:
class MY_Controller extends CI_Controller {

  protected $data = array();

  function __construct() {
    parent::__construct();
  }
class Admin_Controller extends MY_Controller {

    function __construct()
    {
        parent::__construct();
        // Check login, load back end dependencies
    }
    function render_page($view) {
    if( ! $this->input->is_ajax_request() )
    {
      $this->load->view('templates/header', $this->data);
    }
    $this->load->view($view, $this->data);

    if( ! $this->input->is_ajax_request() )
    {
     $this->load->view('templates/menu');
     $this->load->view('templates/footer', $this->data);
    }
  }  
}
class Public_Controller extends MY_Controller {

    function __construct()
    {
        parent::__construct();
        // Check login, load back end dependencies
    }


   function render_page($view) {
    if( ! $this->input->is_ajax_request() )
    {
      $this->load->view('templates/header', $this->data);
    }
    $this->load->view($view, $this->data);

    if( ! $this->input->is_ajax_request() )
    {
     $this->load->view('templates/menu');
     $this->load->view('templates/footer', $this->data);
    }
  }  
}
}

Can you tell me is this a good way, how can I continue ; I mean how can I seperate admin edit link because I dont use function index my example home controller is :

Code:
public function view($page = 'home')
  {
   $this->load->helper('text');
   $this->load->model('services_model');
   $this->data['records']= $this->services_model->getAll();
   if ( ! file_exists('application/views/pages/'.$page.'.php'))
   {
    // Whoops, we don't have a page for that!
    show_404();
   }
   $data['title'] = ucfirst($page); // Capitalize the first letter
   $this->render_page('pages/'.$page,$data);
  }
Or shall i use a basic admin controller like this home controller.
Thank you for your suggestions.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.