note 46789 deleted from function.include by sean

From: Date: Sat, 23 Oct 2004 14:41:51 +0000
Subject: note 46789 deleted from function.include by sean
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79000@lists.php.net to get a copy of this message
Note Submitter: legeis at lycos dot co dot uk ---- Don't know if this is overkill but this is what i came with up to compensate for include function directory problems you have eg. /dir1/file1.php /dir1/dir2/file2.php /dir1/includefile.php file1.php <? include('includefile.php')?> file2.php <? include('includefile.php')?> will give you "Warning: include('includefile.php'): failed to open stream: No such file or directory...." so i came up with file1.php <? $dirs = array("",".","..","../.."); $amount = substr_count($_SERVER['PHP_SELF'], "/"); $dir = "{$dirs[$amount]}/includefile.php"; include($dir) ?> file2.php <? $dirs = array("",".","..","../.."); $amount = substr_count($_SERVER['PHP_SELF'], "/"); $dir = "{$dirs[$amount]}/includefile.php"; include($dir) ?> hope it helps and if there is a better way besides include_path please let me know ---- Reason: useless note

« previous php.notes (#79000) next »