note 28442 added to configuration.directives
| From: | Bret at rack1 dot php dot net | Date: | Mon, 13 Jan 2003 18:46:50 +0000 |
| Subject: | note 28442 added to configuration.directives | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42064@lists.php.net to get a copy of this message | ||
Probably the easiest way I have found (especially if running multiple big php projects on a single
server) is to create a "master" script for each project that declares a variable $COMMON
(or something like that). This can be different for each project, for example:
project 1
=======
<?php
$COMMON = "/php/includes/project1/"
?>
project 2
=======
<?php
$COMMON = "/php/includes/project2/"
?>
Put each of these files in (one of) the include directory specified in php.ini. Then, in each
script of a given project, do this:
<?php
include "project#.php" // where # is the desired project file
include "${COMMON}myinclude1.php"
include "${COMMON}myinclude2.php"
// ...etc...
?>
You can then move stuff around easily, port over to a different server, have the same include file
names in different projects, etc, etc (like I usually have a gui.php file that paints my screens, in
each project, but they obviously work very differently in each project).
Secondary note: you should always use php as the extension for your includes so someone can't
get the source through the browser by "guessing" at file names. I see a lot of people
using "inc" or something like that.
Share and enjoy,
Bret
--
http://www.php.net/manual/en/configuration.directives.php
http://master.php.net/manage/user-notes.php?action=edit+28442
http://master.php.net/manage/user-notes.php?action=delete+28442
http://master.php.net/manage/user-notes.php?action=reject+28442