Welcome Guest, Not a member yet? Register   Sign In
Is this the proper way to structure a class?
#1

[eluser]behnampmdg3[/eluser]
Hi;

Is this the proper way to structure a class?

Code:
class Orders extends CI_Controller {
  
public function index()
  {
   $this->load_page_requirements();
   $this->check_user_login_status();
   $this->load_view_variables();
   $this->load_views();
  }

public function load_view_variables()
  {
   $this->data['username'] = "Welcome ".ucfirst(html_escape($this->session->userdata['logged_data']['username']));
   $this->data['log_out_button'] = LOG_OUT;
   $this->data['bread_crumb_title']="Orders";
  }

public function check_user_login_status()
  {
   if(!$this->header->logged())
    {
     redirect(site_url('log_in'), 'refresh');
    }
  }
public function load_page_requirements()
  {
   $this->load->model('model_auth');
   $this->load->library('header');
   $this->header->index();
  }
public function load_views()
  {
   $this->load->view('header_view', $this->data);
   $this->load->view('left_menu_view');
   $this->load->view('sub_menu_two_view');
   $this->load->view('orders_view');
   $this->load->view('footer_view');
  }
}




Theme © iAndrew 2016 - Forum software by © MyBB