ajout recherche

This commit is contained in:
2024-05-29 10:50:49 +02:00
parent aa05e82ca5
commit 2d1b8c0a45
6 changed files with 88 additions and 3 deletions

View File

@@ -10,10 +10,21 @@ class Chansons extends CI_Controller {
$this->load->helper('url');
}
public function index(){
$chansons = $this->model_music->getChansons();
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');
}
}