![]() |
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! |
Just wondering if anyone can help?
|
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> |
That doesn't work
Error: The navigation element title is invalid. |
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') |
Doesn't output anything.
Used this (active too) Code:
if (!defined('VB_AREA') OR VB_AREA != 'AdminCP') |
As a test, try changing the code like this:
Code:
$navdata['tab_oda5_837']['text'] .= ' X<script language="javascript" src="/logon_users.php"></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. |
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. |
It seems like that would have to be a problem with the script you're calling.
|
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/"; [~/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 |
I don't know anything about that software. But if you figure out what ~ stands for (it's your user directory) then you might be able to use that. I suppose you could try
Code:
$chat_data_path = "~/TopCMM/123FlashChat9.6/server/data/default/"; but I can't remember offhand if you're allowed to use ~ with php functions or is it only works in shell commands. And even if it does work, I'm not sure the web server is running as that same user. |
Yes tried that too, didn't work
--------------- Added [DATE]1365474629[/DATE] at [TIME]1365474629[/TIME] --------------- Ok. Got the plugin working right with below Code:
if (!defined('VB_AREA') OR VB_AREA != 'AdminCP') I want the number output floating right with a custom background color too while the word "chat" remains floating left. Thanks in advance |
It's a quote matching problem. The whole thing is already a string inside single quotes. But what you could do is put the html outside the script tags, like:
Code:
$navdata['tab_oda5_837']['text'] .= '<script language="javascript" src="http://www.talkjesus.com:35555/online.js?group=default"></script> |
All times are GMT. The time now is 05:44 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|