Re: auto appending for each directory

From: Date: Thu, 08 Feb 2001 09:26:03 +0000
Subject: Re: auto appending for each directory
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-38725@lists.php.net to get a copy of this message
> 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

« previous php.general (#38725) next »