Alright I've experimented with it a bit but haven't gotten it to work properly yet. This is what I've got so far:
function albums($dir) {
//for now only one level of albums works.
global $album, $title, $photos, $divider, $logo, $photo;
$dirs=getdirs($dir);
if (isset($logo)) { echo $logo; }
if (isset($album)) { echo "<h1>".$album."</h1>"; } else { echo "<h2>".$title."<br /></h2>"; }
echo "<div class=\"album\"><table>";
if (isset($album) || isset($photo)) { echo "<a href=\"".$_SERVER['PHP_SELF']."\">$title Home</a>$divider\n"; }
else { }
$i = 0;
if (count($dirs)>$i) {
foreach ($dirs as $value) {
if (is_int(($i+1)/3)) echo "<tr>";
echo "<td><a href=\"".$_SERVER['PHP_SELF']."?album=".urlencode($value)."\">".$value."</a>$divider</td>\n";
if (is_int(($i+1)/3)) echo "</tr>";
}
}
echo "</table></div>";
}