Last post on your site

Satioz

New Member
Well here is the code what i using to show the last post on my site. It's very easy to use. You most only change the mysql database info, and its working.

Here it is:

PHP:
<?php

$limiet = 10; //Aantal topics
$pad = "http://www.het-legioen.nl/forum/"; // Pad naar forum (met slash)
 //Here change the mysql!
      mysql_connect(localhost,dbname,password) or die(mysql_error());

      mysql_select_db(dbname) or die(mysql_error());

      $aSql = "SELECT * FROM forumthread ORDER BY lastpostid DESC LIMIT 0,$limiet";
      $aQuery = mysql_query($aSql);

      while ($aShow = mysql_fetch_object($aQuery))

      {

      echo "<a href=\"".$pad."showthread.php?p=".$aShow->lastpostid."#".$aShow->lastpostid. "\" target=\"_BLANK\">»&nbsp;".$aShow->title."</a><br />" ;

      }

        ?>

When you have the standard prefix (vb_ then you most edit forumthread into vb_thread. Did you have an another prefix, then you edit this into that. Did you not sure what your prefix is? Look then in your database and fill in the prefix what you see dear.

Have luck, and for a preview you can look on this site: Het-Legioen.nl - Woorden én daden

Good luck, and hope you like it.
 
No php required, it uses your External Data Provider ;)

Admin Control Panel >> vBulletin Options >> vBulletin Options > Admin Control Panel Options > Use External Data Provider:
YES - type = JavaScript

At any location in your custom .html page, add this code:

HTML:
<script type="text/javascript" src="external.php?type=js"></script> 
<script language="" type="text/javascript">
<!--
for (var x in threads)
{
document.writeln("<a href=\"showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+"</a> (Posted By: "+threads[x].poster+")<br />");
}
//-->
</script>

Save the html file, upload it, and you're done.

Note: Don't forget to turn on the External Feed options here:

Admin CP -> vBulletin Options -> External Data Provider
 
Back
Top