note 68776 deleted from function.include-once by salathe

From: Date: Mon, 21 Sep 2020 14:41:11 +0000
Subject: note 68776 deleted from function.include-once by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215265@lists.php.net to get a copy of this message
Note Submitter: webmaster AT domaene - kempten DOT de ---- 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

« previous php.notes (#215265) next »