chanson d'un album
This commit is contained in:
parent
1e2735d5ba
commit
63937f0b53
@ -13,12 +13,11 @@ class Albums extends CI_Controller {
|
||||
$this->load->view('albums_list',['albums'=>$albums]);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
public function view(){
|
||||
$albums = $this->model_music->getSongOfAlbum();
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('song_album_list',['musique'=>$albums]);
|
||||
$this->load->view('layout/footer');
|
||||
public function view($album_id){
|
||||
$songs = $this->model_music->getSongOfAlbum($album_id);
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('song_album_list',['songs'=>$songs]);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -28,13 +28,14 @@ class Model_music extends CI_Model {
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function getSongOfAlbum(){
|
||||
$query = $this->db->query(
|
||||
"SELECT artist.id, artist.name
|
||||
FROM artist
|
||||
Group by artist.id
|
||||
"
|
||||
);
|
||||
return $query->result();
|
||||
public function getSongOfAlbum($album_id){
|
||||
$query = $this->db->query(
|
||||
"SELECT song.id, song.name
|
||||
FROM song
|
||||
INNER JOIN track ON song.id = track.songId
|
||||
WHERE track.albumId = ?",
|
||||
array($album_id)
|
||||
);
|
||||
return $query->result();
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
foreach($albums as $album){
|
||||
echo "<div><article>";
|
||||
echo "<header class='short-text'>";
|
||||
echo anchor("albums/view/song_album_list.php","{$album->name}");
|
||||
echo anchor("albums/view/{$album->id}","{$album->name}");
|
||||
echo "</header>";
|
||||
echo '<img src="data:image/jpeg;base64,'.base64_encode($album->jpeg).'" />';
|
||||
echo "<footer class='short-text'>{$album->year} - {$album->artistName}</footer>
|
||||
|
@ -3,6 +3,13 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
foreach($songs as $song){
|
||||
echo "<div><article>";
|
||||
echo "<header class='short-text'>";
|
||||
echo anchor("albums/view/{$song->id}","{$song->name}");
|
||||
echo "<br>";
|
||||
echo "</header>";
|
||||
echo "</article></div>";
|
||||
}
|
||||
?>
|
||||
</section>
|
||||
</section>
|
||||
|
Loading…
Reference in New Issue
Block a user