PDA

View Full Version : recent forum post problem using external data provider and java script



~kev~
Wed 9th May '07, 9:57am
Enable External Javascript is enabled, to show the recent forum post on the front page I used the code below, and put it below the $navbar. this code is from a vbulletin 3.5 faq page I found on this site. This code seems rather heavy, can someone please point me to a more streamlined JS script to show the recent post? Also, the most recent threads are not showing up on the home page, only some of the recent post.

My site is built with Vbulletin 3.6.5 - installed a month ago.

</if>
<if condition="$vbulletin->options['externaljs']">
<!-- show latest active threads -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%"
align="center">
<tbody>
<tr>
<td class="thead" colspan="2">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_external')"><img
id="collapseimg_forumhome_external"
src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_external].gif" alt="" border="0" /></a>
<a href="search.php?$session[sessionurl]do=getnew">Latest Active Threads</a>
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_external" style="$vbcollapse[collapseobj_forumhome_external]">
<tr>

<td class="alt1" width="100%">

<div class="smallfont">
<script type="text/javascript" src="external.php?type=js"></script>
<script language="" type="text/javascript">
<!--
for (var x in threads)
{
document.writeln("<img class=\"inlineimg\" src=\"$stylevar[imgdir_button]/lastpost.gif\" alt=\"\" border=\"0\" /> <a href=\"showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+"</a> <span class=\"time\">($vbphrase[posted_by]: "+threads[x].poster+")</span><br />");
}
//-->
</script></div>

</td>
</tr>
</tbody>
<!-- show latest active threads -->
</table>
<br />
</if>

peterska2
Wed 9th May '07, 10:56am
1. Heavy in what way?

2. How do you wish it to display

3. This will only display threads in forums that guests have access to. It will not show threads from any other forums.

4. The code displays the most recent threads, not the most recent posts. It also uses the settings in vBulletin Options > External Data Provider to control how often it updates.

~kev~
Wed 9th May '07, 11:12am
1. I saw an example of another recent thread JS and it was only 5 or 6 lines. It was an example code so I did not use it.

2. As the threads are updated, the code is not showing all the updated post, just the newly created threads.

How can I get threads that have been posted to, and newly created threads to display?

peterska2
Wed 9th May '07, 11:27am
1. This will probably have been just the javascript section and not the styling and layout for the box as well.

2 & 3. See number 4 in my post above. If you wish to display latest posts and not latest threads (which is what this displays) then you will require a modification. Please visit vBulletin.org (www.vbulletin.org) for modification advice, support and assistance.