<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Artistes extends CI_Controller {

	public function __construct(){
		parent::__construct();
		$this->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){
			$artistes = $this->model_music->getArtistes();
		}else{
			$recherche=filter_input(INPUT_GET,'recherche');= $this->model_music->getSearchArtistes($recherche);
			$artistes = $this->model_music->getSearchArtistes($recherche);
		}
		$this->load->view('layout/header');
		if ($artistes == false){
			$page = preg_split('/[\/]/',$_SERVER['HTTP_REFERER']);
			$this->load->view('error',['page'=>$page[count($page)-1]]);
			$artistes = $this->model_music->getArtistes();
		}
		$this->load->view('artistes_list',['artistes'=>$artistes]);
		$this->load->view('layout/footer');
	}

}

