ajout liste des artistes
This commit is contained in:
parent
8d97b8f5a1
commit
4f60ba344d
17
ci/application/controllers/Artistes.php
Normal file
17
ci/application/controllers/Artistes.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?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');
|
||||
}
|
||||
public function index(){
|
||||
$artistes = $this->model_music->getArtists();
|
||||
$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();
|
||||
}
|
||||
|
||||
public function getArtists(){
|
||||
$query = $this->db->query(
|
||||
"SELECT artist.id, artist.name
|
||||
FROM artist
|
||||
Group by artist.id
|
||||
"
|
||||
);
|
||||
return $query->result();
|
||||
}
|
||||
}
|
||||
|
14
ci/application/views/artistes_list.php
Normal file
14
ci/application/views/artistes_list.php
Normal file
@ -0,0 +1,14 @@
|
||||
<h5>Artists 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 "<br>";
|
||||
echo "</header>";
|
||||
//echo "<footer class='short-text'>{$artistes->year} - {$artistes->artistName}</footer>
|
||||
//</article></div>";
|
||||
}
|
||||
?>
|
||||
</section>
|
Loading…
Reference in New Issue
Block a user