...

View Full Version : Vbulletin CybTopStats help



ptmuldoon
03-22-2009, 08:33 PM
I've posted this similar question on vbulletin.org, but hoping someone may have a suggestion or two here as well.

I've added the vb advanced Statistic mod here (http://www.vbulletin.org/forum/showthread.php?t=201274&highlight=Statistics) to my vb forums. Its a great mod.

Now, I want to use the mod on some non-vb pages. And this works with limited results. But I can not get the stats to show when used with the MKPortal CMS. It seems its rather difficult to show these stats when used in any portal system.

In trying different things to get the information to show on the portal, I thought to try and call the stats using a function. Now this is where I can an error of:
Fatal error: Call to a member function query_first_slave() on a non-object in C:\wamp\www\mkportal\forum\includes\functions.php on line 1319

And my current testing code is only the below function.


function teststats()
{
$cwd = getcwd();
chdir("../../forum/"); //Path from Mkportal blocks
//chdir("./forum/"); //Path from mkportal index
require_once('global.php');
chdir($cwd);

//$stats = $cybtopstats; //No stats generated?
$stats = "Test information"; //this works
return $stats;
}

$test = teststats();
echo $test;

I really have no current thoughts as why I would be receiving the error. Some google searches mentioned its cause being trying to change DB's. But the above function has no such code.

Anyone have a suggestion or two?

Thanks
PT

timgolding
03-22-2009, 09:19 PM
Is the function inside a class perhaps? and if it is is the code


$test = teststats();
echo $test;
also inside a class in which case it would need to be



$test = $this->teststats();
echo $test;

timgolding
03-22-2009, 09:43 PM
I wrote a small class to see if i could repeat your problem. Heres the class when it works



<?PHP
class hello
{


function print_hello()
{
echo hello;
}

function print_hello_name($name)
{
$this->print_hello();
echo " ".$name;
}

}

$hi=new hello;
$hi->print_hello_name("Tim");
?>


And if i don't declare $hi as a hello object i get this error message
Fatal error: Call to a member function print_hello_name() on a non-object in C:\wamp\www\temp\test.php on line 20



<?PHP
class hello
{


function print_hello()
{
echo hello;
}

function print_hello_name($name)
{
$this->print_hello();
echo " ".$name;
}

}

$hi->print_hello_name("Tim");
?>


So somehow your missing a declaration of the object or it hasn't been processed yet?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum