Phil:

On Fri, May 10, 2002 at 08:01:46PM -0400, Phil Powell wrote:
> 
> How do I fix this problem? I do not want to duplicate the PHP script per
> folder as there will be an enormous amount of dynamically-created subfolders
> and I will have to copy a version per folder.  I want to be able to use the
> one PHP script in the DOCROOT for every PHP script in every subfolder, how
> is this done?

Have a file in each directory called, for the sake of example,
"directory.inc"  In that file, set a variable called, "$root"  The
value of it should be the relative path used to find the root
directory, eg "../../".  This will vary depending on the directory
depth.  Each script on your site then should have
"require('./directory.inc');" at the top.  Now, you'll always know
where to find the root.  This also makes things easy to move from one 
server to another in the future.

Another way to do this is to use the auto_prepend_file setting to 
include your file that has the function in it.
http://www.php.net/manual/en/configuration.php#ini.auto-prepend-file

Enjoy,

--Dan

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to