Result:
Warning: readdir(): supplied argument is not a valid Directory resource in /home/www/inc/researchers_
yeah, I thought of that too...
A little more info.
I am running a java script to create a drop down menu on a php page.
With out this script I have to add in manually to the menu.inc each bio page url for each researcher, and what country / state they are in.
So instead I tried to create a php script that would do it for me.
The script is suppose to goto the top level directory called Reseachers (also the first tag in the drop down menu) create a sub menu listing from each directory (which are called Canada, USA etc) then list the file names in each state menu (i was going to add the remove suffix of file type later)
In the original, manually add by hand menu the format is this:
<td>
<a class="item1" href="javascript:void(0)">
<div class="section">
<a class="item2 arrow" href="javascript:void(0)">
<div class="section">
<a class="item2 arrow" href="javascript:void(0)">
<div class="section">
<a class="item2" href="./index.php?page=r01
</div>
</div>
</td>
*EOP (end of part)
What I want to do is replace this with a script that will do it for me.
BTW "r01" is the content of the John_Doe.bio file (a cheating redirect)
Main Topics
Browse All Topics





by: ZylochPosted on 2005-12-01 at 14:58:27ID: 15400800
Hm... Try this:
">$folder <img src=\"images/arrow1.gif\" width=\"10\" height=\"12\" alt=\"»\" /></a>";
<?php
/* Look into the directory and returns the folders
(country/states)
*/
$country = "Researchers/";
if (is_dir($country)
{
$varstate = opendir($country);
while (false !== ($folder = readdir($varstate))) {
/* list only subdirectories first
let's skip the first two folders (. & ..) */
if ($folder != "." && $folder != "..") {
echo "<a class=\"item2 arrow\" href=\"javascript:void(0)\
$state = "$varstate";
if (is_dir($country.$state)) // add a slash to directories
{
$tmp = ($country.$state .= "/");
}
$biopages = opendir($tmp);
while (false !== ($folder = readdir($biopages))) {
echo "<a class=\"item2\" href=\"";
echo "$country/$state/$file";
echo"\">$file</a>";}
}
}
closedir($varstate);
}
//Close Select
?>