Re: [PHP] global variable for all scripts

2001-11-10 Thread Kurt Lieber

On Saturday 10 November 2001 01:29 pm, you wrote:
> if i like to move my scripts to /www/my_newdir i habe to change the
> include() function in every script

A few options:

1.  Don't use absolute paths -- use relative paths.  Then you don't have to 
worry about it as long as the overall structure of your site stays the same.

2.  set a variable or named constant to the value of your path and then use 
that throughout your site.  For example:

DEFINE("MY_PATH","/www/my_newdir");

include(MY_PATH);

This works well when you have one file that contains all your named constants 
and other stuff that needs to be accessible on a global basis.  You then 
include that one file (using relative paths) at the top of every php page.  
If you need to change a value, you change it once in your global file and be 
done with it.

3.  It's fairly trivial to do an automated search and replace across multiple 
files.  Just do this and let the computer replace all occurances of 
include("/www/my_olddir") to include("/www/my_newdir")

hth

--kurt

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] global variable for all scripts

2001-11-10 Thread sascha biber

hi ppl,

id like to set something like a global variable or constant.
i need this, to set the path of my document root. all scripts should then
use this path.

e.g.
my apache document root is: /www
all my skriptfiles are in /www/my_subdir

i include a special php script in all script files with:
/*

*/

if i like to move my scripts to /www/my_newdir i habe to change the
include() function in every script

any workaround here?

thanks a lot in advance

sascha
--
---
Sascha Biber
Hegenloh Reisen GmbH
t: 0 71 61-67 34-68
f: 0 71 61-67 34-64
m: 0177-589 14 96





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]