From 1e2735d5ba777d63477351e1e12531191a9f8f39 Mon Sep 17 00:00:00 2001 From: brigitte Date: Mon, 27 May 2024 13:08:39 +0200 Subject: [PATCH] =?UTF-8?q?d=C3=A9but=20albums=20+=20son?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci/application/controllers/Albums.php | 6 ++++++ ci/application/models/Model_music.php | 10 ++++++++++ ci/application/views/albums_list.php | 2 +- ci/application/views/song_album_list.php | 8 ++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 ci/application/views/song_album_list.php diff --git a/ci/application/controllers/Albums.php b/ci/application/controllers/Albums.php index 125b4e8..7ee8f12 100644 --- a/ci/application/controllers/Albums.php +++ b/ci/application/controllers/Albums.php @@ -13,6 +13,12 @@ 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'); + } } diff --git a/ci/application/models/Model_music.php b/ci/application/models/Model_music.php index bd9f9ec..5ebda24 100644 --- a/ci/application/models/Model_music.php +++ b/ci/application/models/Model_music.php @@ -27,4 +27,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(); + } } diff --git a/ci/application/views/albums_list.php b/ci/application/views/albums_list.php index 0fd49bb..77ec1ee 100644 --- a/ci/application/views/albums_list.php +++ b/ci/application/views/albums_list.php @@ -4,7 +4,7 @@ foreach($albums as $album){ echo "
"; echo "
"; - echo anchor("albums/view/{$album->id}","{$album->name}"); + echo anchor("albums/view/song_album_list.php","{$album->name}"); echo "
"; echo ''; echo "
{$album->year} - {$album->artistName}
diff --git a/ci/application/views/song_album_list.php b/ci/application/views/song_album_list.php new file mode 100644 index 0000000..d52d76c --- /dev/null +++ b/ci/application/views/song_album_list.php @@ -0,0 +1,8 @@ +
Song of the album
+
+ +
\ No newline at end of file