Hi ya,
I've been working on an automatic page generator for the intranet system in the company I work for. The system basically just allows you to toss in your name, e-mail, some other information, and some HTML
It will then just use some templates and output some nicely formatted HTML with the company letterhead on it.
In the current version it can only save to one directory, which is annoying. In the newer version I'm working on, I'm trying to make it walk up and down directory's, and list the directory contents in a option box. It will work
fine for the home directory, and one directory above home. After that, it dies.
I talked to the local PHP guy, and he was sort of stumped too... Here's some snippets of the code...
<FORM ACTION="generate_test.php3" METHOD="GET">
<SELECT NAME="requested_dir" SIZE="1">
<?php
if(!isset($requested_dir)) { $requested_dir = "."; }
$current_directory = opendir($requested_dir);
while ($entry_name = readdir($current_directory))
{
if(is_dir($entry_name))
{
print("<option>$entry_name</option>\n");
}
}
print("</SELECT>\n");
print(" \n");
?>
<INPUT TYPE="SUBMIT" VALUE="Change Dir">
</form>
That will generate the following HTML output
<FORM ACTION="generate_test.php3" METHOD="GET">
<SELECT NAME="requested_dir" SIZE="1">
<option>.</option>
<option>..</option>
<option>testing</option>
<option>testing.period</option>
</SELECT>
<INPUT TYPE="SUBMIT" VALUE="Change Dir">
</form>
In a nutshell, what I want the script to do, is know what directory it is in. If you click "..", it should go up to a higher level. I'll have to define a global variable or something, but I'm not sure. Anyone have any ideas?