vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   display script code in navgiation tab (https://vborg.vbsupport.ru/showthread.php?t=296945)

Chadi 04-07-2013 02:09 AM

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!

Chadi 04-08-2013 12:10 PM

Just wondering if anyone can help?

kh99 04-08-2013 12:32 PM

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>

Chadi 04-08-2013 01:10 PM

That doesn't work

Error: The navigation element title is invalid.

kh99 04-08-2013 01:26 PM

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>';
  }
}


Chadi 04-08-2013 01:37 PM

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.

kh99 04-08-2013 01:41 PM

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.

Chadi 04-08-2013 01:41 PM

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.

kh99 04-08-2013 01:50 PM

It seems like that would have to be a problem with the script you're calling.

Chadi 04-08-2013 01:51 PM

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


All times are GMT. The time now is 06:16 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.03399 seconds
  • Memory Usage 1,737KB
  • 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
  • (5)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete