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 04-09-2006, 10:21 PM
sebbe's Avatar
sebbe sebbe is offline
 
Join Date: Feb 2006
Location: .se
Posts: 195
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default New box under "What's going on?" which contains information from another database?

I've really tried to search for help but I couldn't find anything usefull. I haven't really modified any vB pages this way before so now I'm gonna ask you experts!

I want to create another box under the "Currently Active Users". It will contain info about how many users are active in our chat.

This is how it looks:


I tried to add the code below in the forumhome template but it won't work. Anyone have any ideas of how I can make this work?

Here's the code I use for the script:
PHP Code:
<!-- Chat Stats -->
<?php
$db
=mysql_connect("*****""*****""*****");
mysql_select_db("*****"$db);

$query   "*****";
$result  mysql_query($query) or die(mysql_error);
$row     mysql_fetch_array($resultMYSQL_ASSOC);
$numrows $row['numrows'];

$query3 "*****";
$result3 mysql_query($query3) or die(mysql_error());

list(
$chattername) = mysql_fetch_array($result3);

?>

<table class="tborder" cellpadding="5" cellspacing="1" border="0" width="100%" align="center">
<tbody>
    <tr>
        <td class="thead" colspan="2">

            <a style="float:right" href="#top" onclick="return toggle_collapse('forumhome_activeusers')"><img id="collapseimg_forumhome_activeusers" src="eablue/buttons/collapse_thead.gif" alt="" border="0" /></a>
            <a href="*****" target="_blank">Currently Active Users In EA Chat</a>: <?php echo $numrows ?>
        </td>
    </tr>
</tbody>
<tbody id="collapseobj_forumhome_activeusers" style="">
    <tr>
        <td class="alt2"><a href="*****" target="_blank""><img src="chat.gif" alt="pic" border="0" height="20" width="20" /></a></td>
        <td class="alt1" width="100%">
            <div class="smallfont">

                <div style="white-space: nowrap">Most active chatter: <b><?php echo $chattername ?></b></div>
                <div>
<?php
$query2 
"*****";
$result2 mysql_query($query2) or die(mysql_error());

while(list(
$name) = mysql_fetch_array($result2))
{
    echo 
$name ", ";
}
?>                
                </div>

            </div>
        </td>
    </tr>
</tbody>
<?php
mysql_close
();
?>
<!-- //Chat Stats -->
Any help is appreciated.
Thanks in advance!
Reply With Quote
  #2  
Old 04-09-2006, 10:55 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You cannot put php code in templates - you need to create a plugin for the code and just put the output variable in the template.
Reply With Quote
  #3  
Old 04-10-2006, 06:01 AM
sebbe's Avatar
sebbe sebbe is offline
 
Join Date: Feb 2006
Location: .se
Posts: 195
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M
You cannot put php code in templates - you need to create a plugin for the code and just put the output variable in the template.
I see. I tried to read pages about hooks & plugins but is all that really necessary for this matter?

Isn't there any easy way to do this?

Edit: I followed this (https://vborg.vbsupport.ru/showthread.php?t=82625) guide and made a plugin. It works if I place it in the index.php like Brad did in that guide but when I try to add it to the template where I want it, it just says:


Any ideas?
Reply With Quote
  #4  
Old 04-12-2006, 07:29 PM
sebbe's Avatar
sebbe sebbe is offline
 
Join Date: Feb 2006
Location: .se
Posts: 195
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No one? Shouldn't be too hard eh?
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 11:21 PM.


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.04558 seconds
  • Memory Usage 2,199KB
  • 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
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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