<section class="list">
<?php
$i = 0;
echo '<img src="data:image/jpeg;base64,' . base64_encode($album->jpeg) . '" alt="' . $album->name . '" />';
echo "<footer class='short-text'>{$album->year} - {$album->artistName}</footer>";
foreach($songs as $song){ 
    echo "<div><article>";
    echo "<header class='short-text'>"; 
    $i = $i+1;
    $minutes = floor($song->duration/60);
    $secondes = $song->duration %60;
    echo "{$i} - {$song->name} : {$minutes} min {$secondes} sec"; 
    if ($this->session->userdata('logged')):
        echo "<form action='" . base_url("index.php/playlist/addSongToPlaylist") . "' method='post'>";
        echo "<select name='playlist'>";
        foreach ($playlists as $playlist) {
            echo "<option value='{$playlist->id}'>{$playlist->name}</option>";
        }
        echo "</select>";
        echo "<input type='hidden' name='song' value='{$song->name}' />";
        echo "<button type='submit' class='add-to-playlist'>+</button>";
        echo "</form>";
    endif;
    echo "<br>"; 
    echo "</header>";
    echo "</article></div>";
}
?>
</section>


