creation aléatoire de playlist

This commit is contained in:
2024-06-16 21:57:34 +02:00
parent 4efd73e0bf
commit 6b9efb4dd0
10 changed files with 304 additions and 193 deletions

View File

@@ -71,14 +71,18 @@
<h5>Chansons list</h5>
<section class="list">
<?php
ini_set('memory_limit', '512M');
$page = preg_split('/[\/]/',$_SERVER['REQUEST_URI']);
$long_page = count($page)-1;
$url = $page[$long_page];
while ($page[$long_page] != 'albums' && $page[$long_page] != 'chansons'){
$long_page = $long_page - 1;
$url = $page[$long_page];
$page = preg_split('/[\/]/', $_SERVER['REQUEST_URI']);
$long_page = count($page) - 1;
$valid_segments = ['albums', 'chansons'];
$url = '';
for ($i = $long_page; $i >= 0; $i--) {
if (in_array($page[$i], $valid_segments)) {
$url = implode('/', array_slice($page, $i));
break;
}
}
foreach($chansons as $chanson){
@@ -98,8 +102,5 @@ foreach($chansons as $chanson){
</article></div>";
}
echo "<div class='pagination-links'>";
echo "<?= $pagination; ?>";
echo "</div>";
?>
</section>