The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How can I access global.php outside of the forums
Here is what I am facing.
I have a website say http://test.com Forums are at http://test.com/forums/ I write a php called "1.php" with the following code. <?php // Turn off all error reporting //error_reporting(0); require_once('global.php'); ?> If I put 1.php under http://test.com/forums/1.php, the page does not generate any errors. But if I chnage the code in 1.php to: <?php // Turn off all error reporting //error_reporting(0); require_once('/forums/global.php'); ?> and put it directly in the root, it gives me an error. like in http://test.com/1.php Error Message: Warning: require_once(/forums/global.php) [function.require-once]: failed to open stream: No such file or directory in E:\staging\test\1.php on line 6 Fatal error: require_once() [function.require]: Failed opening required '/forums/global.php' (include_path='.;C:\php5\pear') in E:\staging\test\1.php on line 6 What am I doing wrong? |
#2
|
||||
|
||||
You have to chdir to where globals lives, include it, then chdir back to th original directory.
|
#3
|
|||
|
|||
Can you help me with the code here ?
If globals.php is under /forums, how will I change the code? <?php // Turn off all error reporting //error_reporting(0); require_once('global.php'); ?> Edit: I was able to figure it out. I am from a non php background. Curious as to why I should change a working directory to accommodate "globals.php" Why cannot an include work? |
#4
|
||||
|
||||
Beats me dude, I just work here.
|
#5
|
|||
|
|||
Thats ok.
Tx man |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|