Hi all,
I've been working on modifying some code for an image gallery and I've run into a snag. The idea is that when you are in the root directory area, it displays a nicely formatted list of all the subdirectories like so:
root | subdir1 | subdir2 | subdir3
Then when you descend into a subdirectory, it produces something like this:
root / subdir1
What I want it to do is continue to look like the first set of links (root | subdir1 | subdir2 | subdir3) no matter where you click and where you go in the directory structure. But I'm a total novice and I haven't really worked out what all these $i's do, and so far my attempts at modifying this haven't worked. Can someone please assist me? Here are the relevant pieces of code:
<?
// display current directory
if(!$dir) echo $txt_root_dir."";
else echo "<a href=\"?dir=\">".$txt_root_dir."</a>";
$alldirs=explode("/",$dir);
$alldirtmp="";
for($i=0;$alldirs[$i];$i++) {
$alldirtmp.=$alldirs[$i]."/";
if($alldirs[$i+1] || $display) echo "<a href=\"?dir=".rawurlencode($alldirtmp)."\">";
echo $alldirs[$i];
if($alldirs[$i+1] || $display) echo "</a>";
}
?>
<?
// display directories
for($i=0;$i<$nb_dirs;$i++) {
echo " |";
echo " <a href=\"?dir=".rawurlencode($dir.$dirs[$i])."\">".$dirs[$i]."</a>";
}
?>