note 18017 modified in function.require by sniper
| From: | sniper@php.net | Date: | Wed, 29 Jan 2003 04:31:24 +0000 |
| Subject: | note 18017 modified in function.require by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-43005@lists.php.net to get a copy of this message | ||
Our family of domains uses - instead of a "global" page - a "universal" page,
which sets variables and functions for each domain and their subsequent content. However, the
problem facing us was the varying directory structure, as many pages lie in
universalmetropolis.com/radio, for example, whilst others fall in
universalmetropolis.com/radio/cafe, and so forth. Additionally, our universal.php page calls several
more important pages (i.e. require("functions.php"), require("variables.php"),
etc), which further complicates matters. I tried the real path and several other things posted as
comments on this page, and have once again found something better that works for us:
// From each page calling the global/universal page, would be the standard "require" line:
require("admin/global.php");
--
// Then, in your global.php page, you have a line near the top as follows to declare the path from
the original page:
$adminpath="$DOCUMENT_ROOT/admin/";
// finally, the other pages that are called as required:
// load functions
include("$adminpath/functions.php");
// load system variables
require("$adminpath/variables.php");
// include umcodes
require("$adminpath/umcodes.php");
The reason this particular way works best for us is because the big project we are working on now is
brandable, meaning that admins of each CMS/web-based intranet suite may want to name their
directories differently, or use the global.php in other sections of their site. With my example
here, even a clueless admin will be able to find the line at the top of the page to edit the
"adminpath" in case they want to change the name of the directories, and can be used
anywhere on their site.
--was--
Our family of domains uses - instead of a "global" page - a "universal" page,
which sets variables and functions for each domain and their subsequent content. However, the
problem facing us was the varying directory structure, as many pages lie in
universalmetropolis.com/radio, for example, whilst others fall in
universalmetropolis.com/radio/cafe, and so forth. Additionally, our universal.php page calls several
more important pages (i.e. require("functions.php"), require("variables.php"),
etc), which further complicates matters. I tried the real path and several other things posted as
comments on this page, and have once again found something better that works for us:
// From each page calling the global/universal page, would be the standard "require" line:
require("admin/global.php");
--
// Then, in your global.php page, you have a line near the top as follows to declare the path from
the original page:
$adminpath="$DOCUMENT_ROOT/admin/";
// finally, the other pages that are called as required:
// load functions
include("$adminpath/functions.php");
// load system variables
require("$adminpath/variables.php");
// include umcodes
require("$adminpath/umcodes.php");
The reason this particular way works best for us is because the big project we are working on now is
brandable, meaning that admins of each CMS/web-based intranet suite may want to name their
directories differently, or use the global.php in other sections of their site. With my example
here, even a clueless admin will be able to find the line at the top of the page to edit the
"adminpath" in case they want to change the name of the directories, and can be used
anywhere on their site.
Hopefully this comment will stay up (unlike my EVAL() one that was apparently too helpful to other
people and hence had to be removed). Thank you to all my fans - we love you guys.
http://www.php.net/manual/en/function.require.php