[nycphp-talk] How do you do the equivalent of $PHP_SELF for PHP scripts not in docroot?
Phillip Powell
phillip.powell at adnet-sys.com
Tue May 18 14:24:24 EDT 2004
Joel De Gan wrote:
>On Tue, 2004-05-18 at 12:36, Andrew Yochum wrote:
>
>
>>Try the __FILE__ constant. Example:
>> echo __FILE__;
>>
>>
>>
>
>There is also getcwd() for the dir.. i.e.
>$dir = getcwd();
>$file = $dir . "/" . $PHP_SELF;
>
>cheers
>
>
Thanx. This, however, opened up a rather annoying can-of-worms at this
point. My company wants me to ensure that the application I built is
thoroughly portable and scalable, of course, not unreasonable. Which
means that all of the required code will be thoroughly portable from
Client A thorugh Client Z and will work exactly the same for Client A
through Client Z.
This means that it needs to globally include two library scripts I
wrote: one (client_globals.inc.php) that will set all of the
client-related global variables/functions/classes/stuff, and one
(project_globals.inc.php) that will set all of the
client-related-project-related global stuff specific to that client's
project.
The code I wrote to do this is this and resides only in one file
(index.php):
[PHP]
require(realpath($_SERVER['DOCUMENT_ROOT'] .
'/acme/acme_globals/client_globals.inc.php')); // GET GLOBAL ACME
- SCOPE ITEMS/CLASSES
// GET PROJECT-SCOPE VARIABLES FOR I.C.
require(realpath("$DOCUMENT_ROOT/$clientFolderName/image_catalog/image_catalog_globals/project_globals.inc.php"));
[/PHP]
Here's the problem. Suppose that my company wants to market this
product out to another client, Foo Industries. That would mean that the
folks that get my application will have to literally MANUALLY change the
lines in index.php from 'acme' to 'foo' or whatever the folder name will
be for that client. This is, of course, quite a major-league hassle to
ask for. And frankly, I just can't think of any system I want to use
that would be able to automate the process so that the code in index.php
can remain fairly "static" and not needing to be physically altered from
client to client.
If anyone can think of how I might be able to approach this, I'm all ears.
Thanx
Phil
--
---------------------------------------------------------------------------------
Phil Powell
Multimedia Programmer
BPX Technologies, Inc.
#: (703) 709-7218 x107
Fax: (703) 709-7219
More information about the talk
mailing list