33 lines
993 B
PHP
33 lines
993 B
PHP
<h5>Artistes list</h5>
|
|
<section class="list">
|
|
<?php
|
|
$artistAlbums = array();
|
|
|
|
foreach ($artistes as $artist) {
|
|
|
|
if (!array_key_exists($artist->artistName, $artistAlbums)) {
|
|
$artistAlbums[$artist->artistName] = array();
|
|
}
|
|
$artistAlbums[$artist->artistName][] = array(
|
|
'albumName' => $artist->albumName,
|
|
'albumId' => $artist->albumId,
|
|
'year' => $artist->year
|
|
);
|
|
}
|
|
|
|
foreach ($artistAlbums as $artistName => $albums) {
|
|
echo "<div><article>";
|
|
echo "<header class='short-text'>";
|
|
echo "<h2>$artistName</h2>";
|
|
echo "</header>";
|
|
echo "<ul>";
|
|
foreach ($albums as $album) {
|
|
echo "<li>" . anchor("music/view/{$album['albumId']}", $album['albumName']) . " - " . $album['year'] . "</li>";
|
|
echo "<button onclick=\"location.href='" . site_url("playlist/choix_playlist/{$album['albumId']}") . "'\">Ajouter toutes les chansons à la Playlist</button>";
|
|
}
|
|
echo "</ul>";
|
|
echo "</article></div>";
|
|
}
|
|
?>
|
|
</section>
|