Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-22-2009, 04:57 PM
ptmuldoon ptmuldoon is offline
 
Join Date: Feb 2005
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Error: function query_first_slave()

I'm trying to get the Cybtopstats to show on a non-vb page in an MkPortal CMS. I understand its difficult (perhaps impossible) to get the stats to show on a portal. I can get the stats to show on a normal, non-vb page, just not in my portal.

So in learning/playing, I wanted to see about returning the stats information from a function, but am getting 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 this is the entire php page/function at the moment. I really have no idea what would be causing the error. I'm not connecting or changing to different DB's or anything as I saw could be a cause for this error.

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;
    return 
$stats;
}

$test teststats();
echo 
$test
Reply With Quote
  #2  
Old 03-22-2009, 04:59 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Probably that you are calling global.php again. You should only call it once on a page.
Reply With Quote
  #3  
Old 03-22-2009, 06:09 PM
ptmuldoon ptmuldoon is offline
 
Join Date: Feb 2005
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Probably that you are calling global.php again. You should only call it once on a page.
Thanks for the help. But can you explain how I would be calling the global.php file more than once? This is all in a non-vbulletin page, and the above function is the only code at the moment.

Wouldn't calling the function be getting the global.php file once?
Reply With Quote
  #4  
Old 03-22-2009, 06:23 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That is all that is in the php page? You need much more than that. See this article - [How-To] vBulletin API Basics: Creating Custom Pages & Misc.

If you need more help, you should post the whole php page and template here.
Reply With Quote
  #5  
Old 03-22-2009, 09:22 PM
ptmuldoon ptmuldoon is offline
 
Join Date: Feb 2005
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Perhaps I'm confusing myself or not explaining correctly. Currently, I am trying to include the Cyb - Advanced Forum Statistics into the MKPortal cms. It appears that adding these stats to any portal can be rather difficult.

I learned that I can create a non-vb page and show the stats with the below code (add adding the file name to the cybtopstats options), without adding all of the information from the link you provided. I don't think its needed to include all the additional vb phrases, etc or is it?

PHP Code:
define('THIS_SCRIPT''cybtopstats');   
$cwd getcwd();
chdir("../../forum/");  //Path to forums
require_once('global.php');
chdir($cwd);
echo 
$cybtopstats
The problem now is just finding a way to get that same information to show on a portals home page. That above code works by itself, but does not seem to work when added to a portal/cms. Again, it seems an issue with trying to get the stats to show on various cms/portals. I'm unsure why that would be the case though, but it seems to be a difficult task.

So I'm looking at various other ways to try and access the $cybtopstats. One thought was to try and do it in a function, and call the function in the portal. Perhaps thats not the best approach. I am open to any suggestion to echo the data.
Reply With Quote
  #6  
Old 03-22-2009, 10:32 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you want to include $cybtopstats in another page, you need to actually define it somewhere. Simply echoing it will do nothing because nowhere in that code do you actually define it. (Unless it is somehow defined in some plugin that gets called in global.php?) And, if you expect it to be included in a portal page, does that portal page already 'include' the global.php page or any other vb page?
Reply With Quote
  #7  
Old 03-22-2009, 10:35 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think the best way is to look what the cybtopstats plugin is doing and to copy the code the code instead of including the whole vb "framework"
Reply With Quote
  #8  
Old 03-23-2009, 01:40 PM
ptmuldoon ptmuldoon is offline
 
Join Date: Feb 2005
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ragtek View Post
I think the best way is to look what the cybtopstats plugin is doing and to copy the code the code instead of including the whole vb "framework"
I would probably have to agree, and think looking to copy the plugin code is the best approach. Somehow the global.php file is defining the $cybtopstats template variable, since including the global and echoing the variable does work, without defining the variable first.

I had copied the plugin code out, and its pretty complex stuff. I'll have to think more on it going forward, and see what I can learn from the plugin code.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:32 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04596 seconds
  • Memory Usage 2,237KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete