33 lines
993 B
PHP
Raw Normal View History

2024-06-10 14:08:26 +02:00
<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,
2024-06-17 15:10:10 +02:00
'albumId' => $artist->albumId,
2024-06-10 14:08:26 +02:00
'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) {
2024-06-17 15:10:10 +02:00
echo "<li>" . anchor("music/view/{$album['albumId']}", $album['albumName']) . " - " . $album['year'] . "</li>";
2024-06-18 18:58:04 +02:00
echo "<button onclick=\"location.href='" . site_url("playlist/choix_playlist/{$album['albumId']}") . "'\">Ajouter toutes les chansons à la Playlist</button>";
2024-06-10 14:08:26 +02:00
}
echo "</ul>";
echo "</article></div>";
}
?>
</section>