Skip to content

Commit

Permalink
fixed wrongly nested div structure in Songlist by Artist (issue blood…
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis-coding-UGNG committed Feb 29, 2020
1 parent c10635e commit 2e0dff9
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions ugsphp/views/song-list-detailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,39 @@ function BuildSongListByArtist($SongList)
$currentLetter = '';
$songLetter = '';
$currentArtist = '';
$initList = true;
foreach($SongList as $song)
{
$songLetter = substr($song->Artist, 0, 1);

if(strtoupper($currentLetter) != strtoupper($songLetter))
if(strtoupper($currentLetter) != strtoupper($songLetter) || $initList == true)
{
$newLetter = true;
if ($currentArtist != $song->Artist)
{
echo '</ul></div>';
}
$currentLetter = $songLetter;
echo "<div class='SongListLetter'>".strtoupper($currentLetter)."</div>";
echo '<div class="SongListLetter">'.strtoupper($currentLetter).'</div>';
}

if(strtoupper($song->Artist) != strtoupper($currentArtist))
if(strtoupper($song->Artist) != strtoupper($currentArtist) || $initList == true)
{
if($currentArtist != '')
if($currentArtist != '' && $newLetter == false)
{
echo '</ul></div>';
}
$newLetter = false;
$currentArtist = $song->Artist;
echo '<div class="SongListArtist">'.$currentArtist.'<ul>';
}

echo '<li>' . MakeArtistRowHtml($song) . '</li>';
echo '<li>';
echo ' <a href="'.$song->Uri.'"'.(Config::openSongInNewTab?' target=_blank':'').'><span class="SongListSong" data-searchable="'.$song->Artist.' - '.$song->Title.'">'.$song->Title.'</span></a>';
echo '</li>';
$initList = false;
}
echo '</ul></div>'; //close the last artist's song list
}

// Build a songlist, alphabetically ordered, by TITLE
Expand Down

1 comment on commit 2e0dff9

@moana-digital
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems perfect to me :)
I'll manage with this code thank you a lot
Is there anything I can do for you? Tell me.
Thank you again

Please sign in to comment.