查看: 6478|回复: 0
打印 上一主题 下一主题

php借新浪的滚动焦点图flash,用程序自动调用论坛中的图片

[复制链接]
跳转到指定楼层
1#
发表于 2007-9-30 15:58:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
台州网址导航
演示地址: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。当然如果你取消文字部分那就没什么问题了。
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享分享 分享淘帖
台州维博网络(www.tzweb.com)专门运用PHP+MYSQL/ASP.NET+MSSQL技术开发网站门户平台系统等。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

网站推广
关于我们
  • 台州朗动科技(Tzweb.com)拥有多年开发网站平台系统门户手机客户端等业务的成功经验。主要从事:政企网站,系统平台,微信公众号,各类小程序,手机APP客户端,浙里办微应用,浙政钉微应用、主机域名、虚拟空间、后期维护等服务,满足不同企业公司的需求,是台州地区领先的网络技术服务商!

Hi,扫描关注我

Copyright © 2005-2026 站长论坛 All rights reserved

Powered by 站长论坛 with TZWEB Update Techonolgy Support

快速回复 返回顶部 返回列表