ajout liste artiste
This commit is contained in:
20
CodeIgniter-3.1.13/application/controllers/Artistes.php
Normal file
20
CodeIgniter-3.1.13/application/controllers/Artistes.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?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(){
|
||||||
|
$artistes = $this->model_music->getArtistes();
|
||||||
|
$this->load->view('layout/header');
|
||||||
|
$this->load->view('artistes_list',['artistes'=>$artistes]);
|
||||||
|
$this->load->view('layout/footer');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -17,4 +17,14 @@ class Model_music extends CI_Model {
|
|||||||
);
|
);
|
||||||
return $query->result();
|
return $query->result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getArtistes(){
|
||||||
|
$query = $this->db->query(
|
||||||
|
"SELECT artist.name, artist.id
|
||||||
|
FROM artist
|
||||||
|
ORDER BY artist.name
|
||||||
|
"
|
||||||
|
);
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
CodeIgniter-3.1.13/application/views/artistes.php
Normal file
12
CodeIgniter-3.1.13/application/views/artistes.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<h5>Artiste list</h5>
|
||||||
|
<section class="list">
|
||||||
|
<?php
|
||||||
|
foreach($artistes as $artistes){
|
||||||
|
echo "<div><article>";
|
||||||
|
echo "<header class='short-text'>";
|
||||||
|
echo anchor("artistes/view/{$artistes->id}","{$artistes->name}");
|
||||||
|
echo "</header>";
|
||||||
|
echo "</article></div>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</section>
|
||||||
Reference in New Issue
Block a user