Implement Vbulletin (global.php) in a function

Peec

New Member
It seems to me that it doesn't work to include vbulletin's global.php in a function but it works in global scope....


THIS works! Globally include global.php.
PHP:
   $cwd = getcwd();
   chdir($cwd.'/forum');
   require_once('global.php');
   echo "DONE SCRIPT!";


This does not work!
Including global.php IN a function does not work, and i need it to work to integrate it in my framework : /
PHP:
class t{
function test(){
   $cwd = getcwd();
   chdir($cwd.'/forum');
   require_once('global.php');
   echo "DONE SCRIPT!";
}
}
$t = new t;
$t->test();

The error it gets is:
Code:
Fatal error: Call to a member function query_first_slave() on a non-object in /var/www/rsbot.info/forum/includes/functions.php on line 1368

My question:

Are there any workarounds for this ? I can't figure anything.

I tried the following in my test function..:
PHP:
global $vbulletin,$db;
PHP:
extract($GLOBALS);
 
Top