Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 7 Years, 6 Months, 4 Weeks ago Need Suggestion/Advice for script code in Index
#1
Solved: 7 Years, 6 Months, 4 Weeks ago
Hey guys, I have a small issue with my forums loading very slow at times due to a script I inserted into the "Index Page Templates > Index" code. I'm at best an amatuer/novice when it comes to any type of coding, so bear in mind I may have overlooked many other better methods of accomplishing my need.

My issue is that while this generally works flawlessly, ocassionally the script that runs on my teamspeak host servers that reports the status of my teamspeak server will run very very slow or completely time out. This causes the forums index not to load completely till this either completes or times out, generally 15-20 when it's running slowly, or longer when it doesn't work at all.

My request is how can I re-implement this function without causing the delay of loading to the rest of the forums, if possible. I thought maybe if this was a plugin that it might work as I would like, and this might give me the added benefit of my server address and port not being viewable in the source code as well, but I admit due to my lack of expertise with coding I simply don't know.

Here is the exact code I inserted into "Index Page Templates > Index", I've edited the server info and the changed the UID to X's to one of the test servers available from the provider in my example code below:

<span id="its113850"></span><script type="text/javascript" src="http://view.light-speed.com/teamspeak3.php?IP=174.36.215.251&PORT=4104&UID=XXXXXX&display=none&font=11px&background=transparent&server_info_background=transparent&server_info_text=%23026CB1&server_name_background=transparent&server_name_text=%23026CB1&info_background=transparent&channel_background=transparent&channel_text=%23026CB1&username_background=transparent&username_text=%23ffffff"></script>

And the index file as it runs on my site here:




<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
<script type="text/javascript">
<!--
	lang.no_new_posts = "{$lang->no_new_posts}";
	lang.click_mark_read = "{$lang->click_mark_read}";
// -->
</script>
</head>
<body>
{$header}
<sf_shoutbox>
<div class="sidebar" style="float: right; width: 20%">

<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">

<tr>
   <td class="thead">
      <strong>Teamspeak Status</strong>
   </td>
</tr>

<!--

<tr>
   <td class="trow1">
      <span id="its113850"></span><script type="text/javascript" src="http://view.light-speed.com/teamspeak3.php?IP=174.36.215.251&PORT=4104&UID=XXXXXX&display=none&font=11px&background=transparent&server_info_background=transparent&server_info_text=%23026CB1&server_name_background=transparent&server_name_text=%23026CB1&info_background=transparent&channel_background=transparent&channel_text=%23026CB1&username_background=transparent&username_text=%23ffffff"></script>
   </td>

</tr>
 
-->
 
</table>
<br />




</div>


<div class="forums" style="float: left; width: 79%;">
{$forums}
</div>
{$boardstats}

<dl class="forum_legend smalltext">
	<dt><img src="{$theme['imgdir']}/on.gif" alt="{$lang->new_posts}" title="{$lang->new_posts}" style="vertical-align: middle; padding-bottom: 4px;" /></dt>
	<dd>{$lang->new_posts}</dd>

	<dt><img src="{$theme['imgdir']}/off.gif" alt="{$lang->no_new_posts}" title="{$lang->no_new_posts}" style="vertical-align: middle; padding-bottom: 4px;" /></dt>
	<dd>{$lang->no_new_posts}</dd>

	<dt><img src="{$theme['imgdir']}/offlock.gif" alt="{$lang->forum_locked}" title="{$lang->forum_locked}" style="vertical-align: middle;" /></dt>
	<dd>{$lang->forum_locked}</dd>
</dl>
<br style="clear: both" />
{$footer}
</body>
</html>


Any suggestions on a better way to implement this without it changing the format too much, or if a plugin would be the best option would be hugely appreciated.

Regards,
Royel



ha, nvm
#2
Solved: 7 Years, 6 Months, 4 Weeks ago
Try making a separate HTML page with that JavaScript you have, and creating an iframe in your template where it once was to that separate page. IIRC iframes will load it separately so it shouldn't delay the main page from loading.
Dennis Tsang
Former MyBB Team Member
Web: http://dennistt.net
#3
Solved: 7 Years, 6 Months, 4 Weeks ago
(12-24-2011, 06:50 AM)Dennis Tsang Wrote: Try making a separate HTML page with that JavaScript you have, and creating an iframe in your template where it once was to that separate page. IIRC iframes will load it separately so it shouldn't delay the main page from loading.

Thank you for the response and suggestion, I implemented it this way and it works flawlessly.
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)