johnobandalong
03-14-2006, 11:00 PM
Okay, so in order to use the vB API, I have to load in the global.php file.
<?php
chdir('/usr/local/apache2/htdocs/forum/');
require_once('./global.php');
// do some stuff
?>
This works fine. But when I try to put the require statement inside a function, it breaks. Maybe because of the variable scope rule??? Does this mean the api is useless for integration with other applications??
<?php
function do_some_stuff(){
chdir('/usr/local/apache2/htdocs/forum/');
require_once('./global.php');
// do some stuff
}
do_some_stuff();
?>
How am I support to effectively integrate vb using the api if I can't load the vb api inside a function?
I found this post https://vborg.vbsupport.ru/showthread.php?t=91514&highlight=global.php+inside+function
Nobody has a solution???
well, I guess the only solution is to put the require(global.php) outside of the function and declare $vbulletin as global.
<?php
chdir('/usr/local/apache2/htdocs/forum/');
require_once('./global.php');
// do some stuff
?>
This works fine. But when I try to put the require statement inside a function, it breaks. Maybe because of the variable scope rule??? Does this mean the api is useless for integration with other applications??
<?php
function do_some_stuff(){
chdir('/usr/local/apache2/htdocs/forum/');
require_once('./global.php');
// do some stuff
}
do_some_stuff();
?>
How am I support to effectively integrate vb using the api if I can't load the vb api inside a function?
I found this post https://vborg.vbsupport.ru/showthread.php?t=91514&highlight=global.php+inside+function
Nobody has a solution???
well, I guess the only solution is to put the require(global.php) outside of the function and declare $vbulletin as global.