Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-07-2013, 02:09 AM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default display script code in navgiation tab

I'd like to display total number of users in chat. The code is below.

<script language="javascript" src="somepath/connections.php"></script>

I want to display it (float right) in the chat tab. The chat tab is created using the default navigation manger.

See www.talkjesus.com

So it says "chat" in the green tab", I want the displayed total users displayed on the right of it like this

chad (space in middle) 10

10 = example of number of users in chat.

My question now, how can I integrate that script code so it displays in the tab specifically? I'm using amend tabid to URL too. The ID is

#tab_oda5_837


Thanks!
Reply With Quote
  #2  
Old 04-08-2013, 12:10 PM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just wondering if anyone can help?
Reply With Quote
  #3  
Old 04-08-2013, 12:32 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should be able to edit the tab in the Navigation Manager and put your javascript code in the Title box, like maybe:

Code:
Chat <script language="javascript" src="somepath/connections.php"></script>
Reply With Quote
  #4  
Old 04-08-2013, 01:10 PM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That doesn't work

Error: The navigation element title is invalid.
Reply With Quote
  #5  
Old 04-08-2013, 01:26 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, it turns out that error is because you can only have 50 characters in that field. So you'll have to use a plugin. Try this: create a new plugin using hook build_navigation_data and this code:

Code:
if (!defined('VB_AREA') OR VB_AREA != 'AdminCP')
{
   if (is_array($navdata['tab_oda5_837']))
   {
      $navdata['tab_oda5_837']['text'] .= ' <script language="javascript" src="somepath/connections.php"></script>';
   }
}
Reply With Quote
  #6  
Old 04-08-2013, 01:37 PM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Doesn't output anything.

Used this (active too)

Code:
if (!defined('VB_AREA') OR VB_AREA != 'AdminCP')
{
   if (is_array($navdata['tab_oda5_837']))
   {
      $navdata['tab_oda5_837']['text'] .= ' <script language="javascript" src="/logon_users.php"></script>';
   }
}
The path and filename are right too.
Reply With Quote
  #7  
Old 04-08-2013, 01:41 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As a test, try changing the code like this:

Code:
      $navdata['tab_oda5_837']['text'] .= ' X<script language="javascript" src="/logon_users.php"></script>';
and see if the X shows up. If it does, then the problem is your script.

You're specifying a php file as a javascript source file, so unless your logon_users.php outputs javascript code (and that code somehow displays a number), it's not going to work.
Reply With Quote
  #8  
Old 04-08-2013, 01:41 PM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nevermind, got it working thanks. Was missing one file.

--------------- Added [DATE]1365432155[/DATE] at [TIME]1365432155[/TIME] ---------------

I spoke too soon. It shows 0, even when I'm logged in.
Reply With Quote
  #9  
Old 04-08-2013, 01:50 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It seems like that would have to be a problem with the script you're calling.
Reply With Quote
  #10  
Old 04-08-2013, 01:51 PM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I noticed I was missing the chat's 2 files, functions and config, which I've uploaded. However, config says

Code:
$chat_data_path = "C:/Program Files/123FlashChatServer6.9.4/server/data/default/";
Those guys installed the chat in my dedicated server's root outside my user's home directory, at
[~/TopCMM/123FlashChat9.6

What should the path be from there in config file which is placed inside my forum's root folder?

I got it displaying "0", but it stays 0 even when I was logged in chat
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 08:43 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.04040 seconds
  • Memory Usage 2,255KB
  • 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
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete