views artistes
This commit is contained in:
parent
a302916138
commit
3ecd5c63e5
application
@ -44,6 +44,7 @@ class Artistes extends CI_Controller {
|
||||
$this->load->view('artist_details', $data);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -123,27 +123,37 @@ class Model_music extends CI_Model {
|
||||
|
||||
return array('album' => $albumDetails, 'songs' => $songs);
|
||||
}
|
||||
|
||||
public function getArtistDetails($artistId) {
|
||||
// Get artist info
|
||||
$this->db->select('artist.name as artistName, artist.id, genre.name as genreName, artist.jpeg');
|
||||
$this->db->from('artist');
|
||||
$this->db->join('album', 'album.artistid = artist.id', 'left');
|
||||
$this->db->join('genre', 'album.genreid = genre.id', 'left');
|
||||
$this->db->where('artist.id', $artistId);
|
||||
$artistQuery = $this->db->get();
|
||||
$artistDetails = $artistQuery->row();
|
||||
|
||||
// Get artist's albums
|
||||
// Get artist's albums with their songs
|
||||
$this->db->select('album.id as albumId, album.name as albumName, album.year');
|
||||
$this->db->from('album');
|
||||
$this->db->where('album.artistid', $artistId);
|
||||
$albumsQuery = $this->db->get();
|
||||
$albums = $albumsQuery->result();
|
||||
|
||||
// Get songs for each album
|
||||
foreach ($albums as $album) {
|
||||
$this->db->select('track.id as trackId, song.name as songName');
|
||||
$this->db->from('track');
|
||||
$this->db->join('song', 'track.songid = song.id');
|
||||
$this->db->where('track.albumid', $album->albumId);
|
||||
$album->songs = $this->db->get()->result();
|
||||
}
|
||||
|
||||
return array('artist' => $artistDetails, 'albums' => $albums);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function getSongDetails($songId) {
|
||||
// Get song details
|
||||
$this->db->select('song.name as songName, track.id as trackId, album.name as albumName, album.year, artist.name as artistName, genre.name as genreName, cover.jpeg');
|
||||
|
@ -4,7 +4,7 @@
|
||||
foreach($artists as $artist){
|
||||
echo "<div><article>";
|
||||
echo "<header class='short-text'>";
|
||||
echo anchor("artist/view/{$artist->artistId}","{$artist->artistName}");
|
||||
echo anchor("artistes/view/{$artist->artistId}","{$artist->artistName}");
|
||||
echo "</header></article></div>";
|
||||
}
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user