codeigniter中的函数render_view

i want to load view using 1 global method in controller, this my method

private function render_view($view=NULL,$data){
      if ( ! file_exists(APPPATH.'views/pages/'.$view.'.php'))
    {
            // Whoops, we don't have a page for that!
            show_404();
    }
      $this->load->view('header/header',$this->data);
      $this->load->view('pages/'.$view, $this->data);
    }


public function index()
    {
      $this->data['title'] = 'Homepage';
      $this->render_view('home_content',$this->data);
    }

    public function shop()
    {

      $this->data['title']='Shoping';
      $this->render_view('shop',$this->data);
    }

this method called every link tag, like

<li><a href="<?php echo base_url ()?>Pages/shop">Shop page</a></li>

and generating view shop. but i have problem, every time i clicked the result is always the object not found. can you help me, oh i'm sory for my rip english xoxoxo

change your methods to this and check

public function index() {
      $data['title'] = 'Homepage';
      $this->render_view('home_content',$data);
    }

public function shop() {

  $data['title']='Shoping';
  $this->render_view('shop',$data);
}

when you do $this->data, you are trying to access a property of the class which you don't have.

Below is your updated code

private function render_view($view=NULL,$data){
      if ( ! file_exists(APPPATH.'views/pages/'.$view.'.php'))
    {
            // Whoops, we don't have a page for that!
            show_404();
    }
      $this->load->view('header/header',$data);
      $this->load->view('pages/'.$view, $data);
    }


public function index()
    {
      $data['title'] = 'Homepage';
      $this->render_view('home_content',$data);
    }

    public function shop()
    {

      $data['title']='Shoping';
      $this->render_view('shop',$data);
    }