vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   New box under "What's going on?" which contains information from another database? (https://vborg.vbsupport.ru/showthread.php?t=112593)

sebbe 04-09-2006 10:21 PM

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:
http://img450.imageshack.us/img450/6885/chat8hn.jpg

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! :)

Paul M 04-09-2006 10:55 PM

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.

sebbe 04-10-2006 06:01 AM

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:
http://img125.imageshack.us/img125/5559/lolz8ta.jpg

Any ideas? :cool:

sebbe 04-12-2006 07:29 PM

No one? Shouldn't be too hard eh? :cool:


All times are GMT. The time now is 05:30 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.01127 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete