I ran into this problem a few months back, here was my solution that worked pretty well; I used
http://php.net/manual/en/function.file-exists.php
http://php.net/manual/en/function.dirname.php
file_exists() will check if the file...well, EXISTS!
Here's how I used it:
PHP Code:
if(file_exists('menu.php')){ require_once('menu.php');}
elseif(file_exists('../menu.php')){ require_once('../menu.php');}
elseif(file_exists('../../menu.php')){ require_once('../../menu.php');}
elseif(file_exists('../../../menu.php')){ require_once('../../../menu.php');}
It will find the directory the file your looking for is in.
Bookmarks