Showing the path of a folder...
Posted: Wed Jan 14, 2004 6:45 pm
I have a script that shows the files and folders in the $folder directory.
In the address bar, you would have something like this:
index.php?folder=folder1/folder2/folder3
I am wanting to display a link to each of those folders on the page:
But the problem with the code above is that it doesn't show the complete path... It ends up looking like this:
/ <a href="index.php?folder=folder1">folder1</a> / <a href="index.php?folder=folder2">folder2</a> / <a href="index.php?folder=folder3">folder3</a>
And I want it to look like this:
/ <a href="index.php?folder=folder1">folder1</a> / <a href="index.php?folder=folder1/folder2">folder2</a> / <a href="index.php?folder=folder1/folder2/folder3">folder1/folder2/folder3</a>
Is there anyway I can do that?
In the address bar, you would have something like this:
index.php?folder=folder1/folder2/folder3
I am wanting to display a link to each of those folders on the page:
Code: Select all
<?php
$show_folders = explode("/", $folder);
for($i = 0; $i < count($show_folders); $i++) {
$where .= " / <a href="{$PHP_SELF}?folder={$show_folders[$i]}">".$show_folders[$i]."</a>";
}
?>/ <a href="index.php?folder=folder1">folder1</a> / <a href="index.php?folder=folder2">folder2</a> / <a href="index.php?folder=folder3">folder3</a>
And I want it to look like this:
/ <a href="index.php?folder=folder1">folder1</a> / <a href="index.php?folder=folder1/folder2">folder2</a> / <a href="index.php?folder=folder1/folder2/folder3">folder1/folder2/folder3</a>
Is there anyway I can do that?