Simple PHP array codeigniter controller

advertisements

I would like to shorten my CodeIgniter controller a bit. Now it looks like this:

case 'klant1':
                $data['title'] = $page;
                $this->load->view('templates/header', $data);
                $this->load->view('pages/klant1', $data);
                $this->load->view('templates/footer', $data);
                break;
case 'klant2':
                $data['title'] = $page;
                $this->load->view('templates/header', $data);
                $this->load->view('pages/klant2', $data);
                $this->load->view('templates/footer', $data);
                break;
case 'klant3':
                $data['title'] = $page;
                $this->load->view('templates/header', $data);
                $this->load->view('pages/klant3', $data);
                $this->load->view('templates/footer', $data);
                break;

I guess there could be a way to use an array or something that makes klant1 + 2 + 3 ?

Could someone help me out with the code? I don't think its hard, but I'm not good with php..


$klan = your_case;    

$data['title'] = $page;
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$klan, $data);
$this->load->view('templates/footer', $data)