note 68776 added to function.include-once
| From: | webmasterATdomaene-kemptenDOTde at osu1 dot php dot net | Date: | Thu, 10 Aug 2006 12:11:46 +0000 |
| Subject: | note 68776 added to function.include-once | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115754@lists.php.net to get a copy of this message | ||
Since I like to reuse a lot of code it came handy to me to begin some sort of library that I stored
in a subdir
e.g. "lib"
The only thing that bothered me for some time was that although everything worked all IDEs reported
during editing
these useless warnings "file not found" when library files included other library files,
since my path were given all relative to the corresponding document-root.
Here is a short workaround that makes that gone:
<?php
// Change to your path
if(strpos(__FILE__,'/lib/') != FALSE){
chdir("..");
}
include_once ('./lib/other_lib.inc');
// ... or any other include[_once] / require[_once]
?>
just adjust the path and it will be fine - also for your IDE.
greetings
----
Server IP: 212.124.37.9
Probable Submitter: 84.156.96.6
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.include-once.php
Edit -- https://master.php.net/note/edit/68776
Del: integrated -- https://master.php.net/note/delete/68776/integrated
Del: useless -- https://master.php.net/note/delete/68776/useless
Del: bad code -- https://master.php.net/note/delete/68776/bad+code
Del: spam -- https://master.php.net/note/delete/68776/spam
Del: non-english -- https://master.php.net/note/delete/68776/non-english
Del: in docs -- https://master.php.net/note/delete/68776/in+docs
Del: other reasons-- https://master.php.net/note/delete/68776
Reject -- https://master.php.net/note/reject/68776
Search -- https://master.php.net/manage/user-notes.php