可以加入类似在 HTML 网页使用 Java Script 调用新帖??
这是一个在vBulletion中的一例子
jsnew.php:
<?
//####################
// 在 HTML 网页使用 Java Script 调用 vBulletin 新帖,作者 cx(http://www.vnuke.com vgate@163.net)
// 使用方法:把本文件保存为 jsnew.php,放到你的 vB 论坛目录下
// 调用格式:<script language="javascript" src="http://your_vb_path/jsnew.php"></script>
$vbpath = "http://www.vnuke.com"; // 论坛 URL,最后不要加“/”
$callforums = '1,2,3,4'; // 希望调用论坛的 forumid,如果调用多个则用半角逗号隔开
$maxnews = 10; // 调用新帖数量
$maxchars = 30; // 标题最大字符数
$defaulticon = "$vbpath/images/icons/icon1.gif"; // 默认图标 URL
$timeformat = 'm月d日'; // 时间格式,比较详细的格式:Y年m月d日 H:i:s
//################################################################################
// 连接 MySQL!
include ("./admin/config.php");
$connect = mysql_connect($servername, $dbusername, $dbpassword) or die(mysql_errno() . ':' . mysql_error());
$select = mysql_select_db($dbname) or die(mysql_errno() . ':' . mysql_error());
// 查询!
$newthreads_query = "SELECT
thread.*,
iconpath
FROM
thread
LEFT JOIN icon USING (iconid)
WHERE
visible!=0
AND forumid IN (0,$callforums)
ORDER BY
lastpost DESC
LIMIT $maxnews";
$newthreads = mysql_query($newthreads_query)
or die(mysql_errno() . '<br>' . mysql_error() . "<br>$newthreads_query");
while ($newthread = mysql_fetch_array($newthreads)) {
$newthread['type'] = ($newthread['replycount'] > 0) ? '回帖' : '新贴';
$newthread['rawtitle'] = str_replace("'", ''', $newthread['title']);
$newthread['title'] = (strlen($newthread['title']) > $maxchars) ? str_replace("'", ''', substr($newthread['title'], 0, $maxchars)) . '..' : $newthread['rawtitle'];
$newthread['datetime'] = date($timeformat, $newthread['lastpost']);
if (!$newthread['iconpath']) {
$newthread['iconpath'] = $defaulticon;
}
$newthread['iconpath'] = strtolower($newthread['iconpath']);
if (strpos($newthread['iconpath'], 'http://') === false) {
$newthread['iconpath'] ="$vbpath/$newthread[iconpath]";
}
// 输出!这部分当然可以自由定义,还可以增加一些元素,例如回复数量($newthread[replycount])、浏览数量($newthread[views])
echo "document.write('<a href=\"$vbpath/showthread.php?goto=lastpost&threadid=$newthread[threadid]\" title=\"$newthread[rawtitle] - $newthread[lastposter] $newthread[datetime]\" target=\"_blank\"><img src=\"$newthread[iconpath]\" border=\"0\" align=\"absmiddle\"> $newthread[type]:$newthread[title] | 浏览数量($newthread[postusername] | $newthread[forumtitle])</a><br />');";
}
?>
jsnew.html:
<script language="javascript" src="jsnew.php"></script>