|
|

演示地址:http://www.laxjyj.com/
首先说明,本站首页的图片仅调用“教育简讯”中主题贴中的图片,该栏目需要验证后主题方可显示!
新浪滚动焦点图的flash见:
http://sports.sina.com.cn/
flash下载地址:http://image2.sina.com.cn/bj/zonghe/pixviewer.swf
(可以将此文件放到自己的空间,不过一般来说,我们自己的空间比新浪更容易崩。除非新浪将此文件修改或放到其他目录中)
修改方法:
1、在首页模板加入以下代码:
在
<!--<?php
下面加:
@require_once(D_P.'data/bbscache/newspoto.php');
然后将下面的代码加到你想显示的适当位置中。
CODE:
<script type="text/javascript">
<!--
var focus_width=260
var focus_height=182
var text_height=25
var swf_height = focus_height+text_height
var swf_height = focus_height+text_height
var pics="$pics"
var links="$links"
var texts="$texts"
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="http://image2.sina.com.cn/bj/zonghe/pixviewer.swf"><param name="quality" value="high"><param name="bgcolor" value="#DADADA">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
document.write('<embed src="http://image2.sina.com.cn/bj/zonghe/pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#DADADA" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
//-->
</script>
[Copy to clipboard]
2、在适当的论坛PHP文件中加入以下代码:(本站将程序加入到验证主题的操作中)
CODE:
$query=$db->query("
SELECT tm.tid,tm.fid,tm.subject,t.attachurl FROM pw_threads tm
LEFT JOIN pw_attachs t ON t.tid = tm.tid
WHERE tm.fid =18 and t.type='img' and ifcheck='1'
ORDER BY postdate DESC
LIMIT 30
");//LIMIT 30 可以根据需要调整,我这里是估算每个主题有6张图片的情况下。
$imgcontent="<?php\n";
$pics=$links=$texts="";
$rs_i=0;
while ($imginfo = $db->fetch_array($query) and $rs_i<5) {//i只调用5张图片
if($rs_tid!=$imginfo[tid]){
$pics.=$db_bbsurl."/".$attachpath."/".$imginfo[attachurl]."|";
$links.=$db_bbsurl."/read.php?tid=".$imginfo[tid]."|";
$texts.=$imginfo[subject]."|";
$rs_i++;//同一主题的只要最后上传的那张图片
}
$rs_tid=$imginfo[tid];
}
$pics=substr($pics,0,-1);
$links=substr($links,0,-1);
$texts=substr($texts,0,-1);
$pics='$pics="'.$pics.'";';
$links='$links="'.$links.'";';
$texts='$texts="'.$texts.'";';
$imgcontent = $imgcontent.$pics."\n".$links."\n".$texts."\n?>";
writeover("data/bbscache/newspoto.php",$imgcontent);
[Copy to clipboard]
注意:
调用的图片大小如果尺寸不合适,将造成部分文字显示不正常。以上这个新浪网页的图片大小均为:258×180。当然如果你取消文字部分那就没什么问题了。 |
|