note 28521 deleted from function.include by sniper

From: Date: Sat, 18 Jan 2003 15:21:35 +0000
Subject: note 28521 deleted from function.include by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-42345@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

« previous php.notes (#42345) next »