Explore.php : a very simple 'file browser' wroted in PHP to manage quickly your web's sites.

Copyright (C) 2002 Paul Delannoy http://tontonpol.dyndns.org
freepol@free.fr
Download (file .tar, 30 Kb) HERE
Here for a french version.

Purpose :     This program will help you by managing the access pages to the HTML's elements placed in a branch of a web site ; it will be placed itself at the root of this particular branch. Explore will generate a menu HTML page, called itself by a reference like this :
<a href="branch/explore.php">Open branch</a>
this homing page will now give access on all the HTML or PDF documents and sub-directories (except thoose you will hide, see below) by a clic on a link generated by Explore. This dynamic menu will now instantaneously reflect all change in the structure of the 'branch'. And, recursively, for each sub-directory, Explore will generate such a menu.

If you use Explore with Apache, you can take the name explore.php as a default name for the initial document for a directory. You can also rename the file to index.php, if your server assign the correct value to the $_SERV["PHP_SELF"] variable (cf. lines 28, 29, 34 et 57 in the script).

Example : http://formation.paysdelaloire.iufm.fr

or this one as a result during my local tests.

Required :         a Web http host that provide support for PHP4 language (perhaps only PHP3 but i have not experienced). PHP must attribute the good values to the following 2 variables (verify with phpinfo() in cas of you are in doubt)  :

$_ENV["PWD"] value : character used as separator between directories in a global path (usually /)
$_SERV["PHP_SELF"] value : full path of the PHP file itself (his relative URL)

Use :       Just arrange your HTML and PDF files in sub-directories and sub-sub-directories, in the branch of your tree where you put the program. Explore.php take for you all the necessary work to write HTML menus from only one call without parameters.

BEWARE : on certain servers, like tiscali.fr, only the upper directory is listed : the self-call with the name aof a sub-directory as parameter don't work. So i wrote a 'light' version, with the constraint that the script MUST BE CALLED index.php, wich is able to copy itself and the two necessaries files 'gnu.jpg' and 'folder.gif' in each sub-directories you are created in the first. Click here for download this version.

The content of files called _info.txt for directories, and the actual values of the <TITLE> tag for HTML pages, are used by Explore in the link related to each object referenced in a menu.

So, each generated menu is composed of :

-A link to the upper level (not effective on the top level of the system : see below for a tip)

-A global title in <H3> : In this directory : (here the content of file _info.txt is displayed) ; if the file _info.txt don't exist the display is (no more information).

-The list (in alphabetical order) of 'visibles' elements in the directory (with a special message if here is nothing to list).

Tips and trucs.       

Il you will NOT list a particular directory (for example, in the case of a images directory) just put the character '_' (underline) at the beginning of his name.

If you want to display a NON AUTOMATIC link (for example, as said above, a link from the uppermost directory to his parent) you can place the <a href=... ad'hoc in the file _info.txt ; for example the following, in the _info.txt located in the directory 'branch' will display after the general "In this directory :..." a link to the parent directory on a second line :

Mathematical documents for future K-9 teachers<br><a href="../index.htm">To the general index</a><br>

Also if you will particular accents in the link for a directory or a page, take care in using 'normalized' HTML (like &eacute;, etc...) and not the accentued key on your keyboard directly.

(Hop zat elpe) With the hope of helping somebody, Paul Delannoy
First publication jan, 2003