note 90339 added to function.ini-set
| From: | gabem dot at osu1 dot php dot net | Date: | Thu, 16 Apr 2009 23:59:00 +0000 |
| Subject: | note 90339 added to function.ini-set | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-153412@lists.php.net to get a copy of this message | ||
After lots of research, including combing through the helpful comments on this page, I've found
this is the most useful way of accessing a folder of includes at the root of a website from any
page..
I simply add this line at the top of each of my .php pages:
<? ini_set("include_path", "." .PATH_SEPARATOR. "../"
.PATH_SEPARATOR. "../../" .PATH_SEPARATOR. "../../../"); ?>
This configures the include_path directive to look for include files up to 3 folders *above* the
current file
Note: Using the PATH_SEPARATOR constant instead of ";" or ":" covers both
Windows & Unix php installations. Also keep in mind that if some of your pages are any deeper
than 3 folders, you will need to add more paths..
Then any include statements (where includes are kept in a folder called "includes" at the
root) look like this:
<? include("includes/header.inc.php"); ?>
Hope this helps.
- gabe m
----
Server IP: 66.207.199.35
Probable Submitter: 24.82.171.23
----
Manual Page -- http://www.php.net/manual/en/function.ini-set.php
Edit -- https://master.php.net/note/edit/90339
Del: integrated -- https://master.php.net/note/delete/90339/integrated
Del: useless -- https://master.php.net/note/delete/90339/useless
Del: bad code -- https://master.php.net/note/delete/90339/bad+code
Del: spam -- https://master.php.net/note/delete/90339/spam
Del: non-english -- https://master.php.net/note/delete/90339/non-english
Del: in docs -- https://master.php.net/note/delete/90339/in+docs
Del: other reasons-- https://master.php.net/note/delete/90339
Reject -- https://master.php.net/note/reject/90339
Search -- https://master.php.net/manage/user-notes.php