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

Reply
 
Thread Tools Display Modes
  #21  
Old 09-22-2005, 07:56 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Then from where comes that text? Or didn't you show the whole script?
Reply With Quote
  #22  
Old 09-22-2005, 10:12 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

api.UserList and api.RoomList are how the info is pulled out. That's all I know about tthis as I got it from the ReahChat site in their documentation. And that is the full script.
Reply With Quote
  #23  
Old 09-22-2005, 10:27 PM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

were you in the room when you did the last test marco asked for?
Reply With Quote
  #24  
Old 09-23-2005, 12:43 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, sir, I was.
Reply With Quote
  #25  
Old 09-23-2005, 11:24 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well if the array is empty, then (if not using mroe code) there is no way the roomname and your membername are in $userCount.

Also you say this is the complete script, but i don't see a Template evaluated or outputed anywhere. So i guess this can't be all.
Reply With Quote
  #26  
Old 09-23-2005, 11:36 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, here is the COMPLETE code I am using in the forumhome_complete hook right now:

PHP Code:
 $port 10010;
function 
getServerAPI($apiCommand)
{
    global 
$port;
    
$result = array();
    
$fp fsockopen("localhost"$port, &$errno, &$errstr2);
    if (!
$fp)
    {
        echo 
"$errstr ($errno)\n";
    }
    else
    {
        
fputs($fp,"GET /?".$apiCommand." HTTP/1.0\n\n");
        
$header true;
        while(!
feof($fp))
        {
            
$line fgets($fp,128);
            if (
$header == false AND ($line trim($line)) != '')
            {
                
$result[] = trim($line);
            }
            else if (
trim($line) == '')
            {
                
$header false;
            }
        }
        
fclose($fp);
    }
    return 
implode(", "$result);
}
$userList getServerAPI"api.UserList" );
$userCount getServerAPI"api.UserCount" );
$roomList getServerAPI"api.RoomList" );
eval(
'$forumhomerealchat = "' fetch_template('forumhome_realchat') . '";'); 
and here is the template for that code:

HTML Code:
 <tbody>
<tr>
<td class="thead" colspan="2">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_activechatters')"><img id="collapseimg_forumhome_activechatters" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_activeusers].gif" alt="" border="0" /></a>
						<a href="javascript:showwin('$vboptions[bburl]/chat/chat.php', 'width=700,height=600, top=50, left=50')" style="text-decoration: none;">$vbphrase[bh_realchat_who]</a>: <if condition="$userCount == '0'">No Users<else /><if condition="$userCount == '1'">$userCount User<else />$userCount Users</if></if>
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_activechatters" style="$vbcollapse[collapseobj_forumhome_activechatters]">
<tr>
<td class="alt2">
						<a href="javascript:showwin('$vboptions[bburl]/chat/chat.php', 'width=700,height=600, top=50, left=50')"><img class="inlineimg" src="$stylevar[imgdir_misc]/chat.gif" alt="$vboptions[bburl] $vbphrase[bh_realchat_rooms]" border="0" /></a></td>
<td class="alt1" width="100%">
<div class="smallfont">
<div>$vbphrase[bh_realchat_available_rooms]: $roomList</div>
<hr size="1" style="color:$stylevar[tborder_bgcolor]" />
<if condition="$userList == ''">
<div>$vbphrase[bh_realchat_users]: None</div>
<else />
<div>$vbphrase[bh_realchat_users]: $userList</div>
</if>
</div>
</td>
</tr>
</tbody>
and then I add $forumhomerealchat to the forumhome template where I want it to show.

Now, here is the code I WAS using before (in the index.php on vB 3.0). It worked but it showed commas after the last room name at times but not all the time. It was sporadic.

PHP Code:
 // REALCHAT WHO'S ONLINE
$port 10010;
function 
getServerAPI($apiCommand)
{
    global 
$port;
    
$result "";
    
$fp fsockopen("localhost"$port, &$errno, &$errstr2);
    if(!
$fp)
    {
        echo 
"$errstr ($errno)\n";
    }
    else
    {
        
fputs($fp,"GET /?".$apiCommand." HTTP/1.0\n\n");
        
$header true;
        while(!
feof($fp))
        {
            
$line fgets($fp,128);
            
// print $line;
            
if ($header == false)
if(
$apiCommand!='api.UserList') {
$result .= trim($line) . ', ';
}else {
$result .= substr($line0, -1); // trim the last ', '
}
            if (
trim($line) == "")
                
$header false;
        }
        
fclose($fp);
    }
    return 
substr($result0, -2); // trim the last ', '
}
$userCount getServerAPI"api.UserList" );
$roomList getServerAPI"api.RoomList" );
// End REALCHAT WHO'S ONLINE 
Reply With Quote
  #27  
Old 09-23-2005, 11:58 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are now executing the function 3 times, and you only posted 2 arrays. Please run again with the print of the array values, and while 1 or more people in the chat.
Reply With Quote
  #28  
Old 09-23-2005, 12:20 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You mean run this again?
PHP Code:
echo "<br>result: <pre>";print_r($result);echo "</pre>"
Reply With Quote
  #29  
Old 09-23-2005, 12:31 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes..
Reply With Quote
  #30  
Old 09-23-2005, 01:14 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here you go. I was in the chat rioom when I ran this.

PHP Code:
 result
Array
(
    [
0] => The Bear's Den [1] Boofo,
)

result: 
Array
(
    [0] => 1
)

result: 
Array
(
    [0] => The Bear'
s Den
    
[1] => The Lobby
    
[2] => Executive Den

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:38 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.04526 seconds
  • Memory Usage 2,303KB
  • Queries Executed 12 (?)
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_html
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete