DEBUG: $msg
"; } // if } // debug function getSongs () { global $songs; $path = "/opt/songbook/Songs"; // Why didn't the previous one execute correctly? $songs = glob("$path/*.pro"); } // getSongs function songsDropdown () { global $songs; print "
"; print "Songs:  "; print ""; print ""; print "
"; } // songsDropdown function artistsDropdown () { global $songs; $artists = getArtists ($songs); print "
"; print "Artists:  "; print ""; print ""; print "
"; } // artistsDropdown function getArtist ($song) { $lyrics = file_get_contents ($song); if (preg_match ("/\{(st|subtitle):(.*)\}/", $lyrics, $matches)) { return trim ($matches[2]); } else { return ""; } // if } // getArtist function getArtists ($songs) { $artists = array(); foreach ($songs as $song) { $artist = getArtist ($song); if ($artist != '') { $artists[$artist] = 1; } // if } // foreach return array_keys ($artists); } // getArtists function formatTable ($songs) { echo "
    "; foreach ($songs as $song) { $artist = getArtist ($song); $title = basename ($song, ".pro"); echo "
  1. $title"; if ($artist != "") { echo " ($artist)"; } // if } // foreach echo "
"; } // formatTable