> I'm developing a web page with a directory structure like this:
>     /main
>     -----/subject1/
>     --------------/subsubsect11
>     --------------/subsubsect12
>     --------------/subsubsect13
>     --------------/subsubsect14
>     --------------/subsubsect15
>     -----/subject2/
>     --------------/subsubsect21
>     --------------/subsubsect22
>     --------------/subsubsect23
>     --------------/subsubsect24
>     --------------/subsubsect25
>     -----/subject3/
> etc.....
>
> What I would like to do is have a menu for each directory which is saved
in
> a seperate file, (so there is a menu for main, menu for subject1, menu for
> subsubject11, etc). I need a php script that finds out what directory a
> current web page is in and automatically append all the menu files for
each
> directory up to the current directory. I know that php has functions for
> both directory access and file access. Could somebody give an idea how I
can
> achieve this with php.

Maybe something like this:
<?php
    function menu($dir){
        if (is_file("$dir/menu.inc")){
            menu("$dir/..");
            include "$dir/menu.inc";
        }
    }
    menu(dirname($PHP_SELF));
?>

Just put a menu.inc in each directory for what should appear at that level.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to