Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Feb 2005
    Posts
    663
    Thanks
    5
    Thanked 14 Times in 14 Posts

    Vbulletin CybTopStats help

    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 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.
    PHP Code:
    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

  • #2
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,517
    Thanks
    114
    Thanked 110 Times in 109 Posts
    Is the function inside a class perhaps? and if it is is the code
    PHP Code:
    $test teststats();
    echo 
    $test
    also inside a class in which case it would need to be

    PHP Code:
    $test $this->teststats();
    echo 
    $test
    You can not say you know how to do something, until you can teach it to someone else.

  • #3
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,517
    Thanks
    114
    Thanked 110 Times in 109 Posts
    I wrote a small class to see if i could repeat your problem. Heres the class when it works

    PHP Code:
    <?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 Code:
    <?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?
    Last edited by timgolding; 03-22-2009 at 09:47 PM.
    You can not say you know how to do something, until you can teach it to someone else.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •