load->model('model_music'); $this->load->helper('html'); $this->load->helper('url'); } public function index(){ if ($recherche=filter_input(INPUT_GET,'recherche') == false or $recherche=filter_input(INPUT_GET,'recherche') == null){ $chansons = $this->model_music->getChansons(); }else{ $recherche=filter_input(INPUT_GET,'recherche'); $chansons = $this->model_music->getSearchChansons($recherche); } $this->load->view('layout/header'); if ($chansons == false){ $page = preg_split('/[\/]/',$_SERVER['HTTP_REFERER']); $this->load->view('error',['page'=>$page[count($page)-1]]); $chansons = $this->model_music->getChansons(); } $this->load->view('chansons_list',['chansons'=>$chansons]); $this->load->view('layout/footer'); } }