Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

首页n格的问题整理与解决[最后更新:2007.11.05 JS调用附件]

[复制链接]
holymonk 发表于 2007-10-1 22:50:20 | 显示全部楼层

图片不显示某个特殊的版面如何写?

,AND f.fid NOT IN (1,2) 这个语句我在index.php成功加过,但在pic.php不知道该如何加。
<?php
/*
design by Clement
*/

//---设置---start
$shownums = 5;//演示个数,超过6则无法使用导航条.
$searchnums = 50;//搜索总数.
$cachelife = 1800;//按照自己的实际情况设置,默认为1800秒.
$orderby = 'dateline';//搜索顺序.按照日期搜索输入dateline.按照浏览次数输入downloads.随机搜索请输入rand.
$cachename = 'showpic';//缓存名.若与何插件冲突请修改,只要不冲突不会影响使用.
$searchfid = ''3,4,5,6,7,8,9";//只搜索3,4,5,6,7,8,9板块内容,我想排除1,2.该如何写?
//---设置---end


if((@!include('forumdata/cache/cache_'.$cachename.'.php')) || $expiration < time() || $cacheshownums != $shownums || $cachesearchnums != $searchnums || $cachecachelife != $cachelife || $cacheorderby != $orderby || $cachecachename != $cachename || $cachesearchfid != $searchfid) {
        require_once './include/common.inc.php';
        $orderby = $orderby != 'rand' ? 'attach.'.$orderby : 'rand()';
        $fids = $searchfid ? 'AND '."t.fid IN ($searchfid)" : '';
        $data = array();
        $query = $db->query("SELECT attach.aid, attach.attachment, t.tid, t.fid, t.subject FROM {$tablepre}attachments attach LEFT JOIN {$tablepre}threads t ON t.tid=attach.tid WHERE attach.readperm='0' AND displayorder>='0' AND filetype='image/pjpeg' $fids GROUP BY attach.tid ORDER BY $orderby DESC LIMIT $searchnums");
        while ($pic = $db->fetch_array($query)) {
                $data['pic'][$pic[aid]]['showpicpics'] = $attachurl.'/'.$pic['attachment'];
                $data['pic'][$pic[aid]]['showpiclinks'] = "viewthread.php?tid=$pic[tid]";
                $data['pic'][$pic[aid]]['showpictexts'] = str_replace('\'', '&nbsp;',$pic['subject']);
        }
        $data['expiration'] = $cachelife + time();
        $data['cacheshownums'] = $shownums;
        $data['cachesearchnums'] = $searchnums;
        $data['cachecachelife'] = $cachelife;
        $data['cacheorderby'] = $orderby;
        $data['cachecachename'] = $cachename;
        $data['cachesearchfid'] = $searchfid;
        require_once DISCUZ_ROOT.'./include/cache.func.php';
        writetocache($cachename, '', getcachevars($data));
        include(DISCUZ_ROOT.'./forumdata/cache/cache_'.$cachename.'.php');
}

shuffle($pic);
$i = 0;
$j = 0;
while ($j < $shownums && isset($pic[$i])) {
        if(is_readable($pic[$i]['showpicpics'])) {
                $showpicpics .= $comma.$pic[$i]['showpicpics'];
                $showpiclinks .= $comma.$pic[$i]['showpiclinks'];
                $showpictexts .= $comma.$pic[$i]['showpictexts'];
                $comma = '|';
                $j++;
        }
        $i++;
}
?>
<script type="text/javascript">
        var swf_width=255       
        var swf_height=175
        var files='<?=$showpicpics?>'
        var links='<?=$showpiclinks?>'
        var texts='<?=$showpictexts?>'
        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="'+ swf_width +'" height="'+ swf_height +'">');
        document.write('<param name="movie" value="images/focus.swf"><param name="quality" value="high">');
        document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
        document.write('<param name="FlashVars" value="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'">');
        document.write('<embed src="images/focus.swf" wmode="opaque" FlashVars="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'& menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'); document.write('</object>');
</script>
回复

使用道具 举报

ggoyy 发表于 2007-10-3 17:59:57 | 显示全部楼层
请教版主:

一、我安装了版主测试过的那个四格(见https://discuz.dismall.com/thread-696558-1-1.html),想请教两个问题:
(1)我想把“本周热门”改为“论坛精华”(随机精华),具体怎么改,在哪儿改?(试用过原四格提供者的“本月精华”,只显示了当月加的两个精华帖子,失败,郁闷~~~)
(2)现在用的这个四格标题行距偏宽了,不紧凑,显得稀稀拉拉的,而且太占位置空间,我想把行距改小一点儿,和论坛首页显示保持一致,具体怎么改?

【在用的四格效果如下图】


【演示地址】http://www.efsky.com/bbs

【所用代码】
1、index.php
//----首页四格代码开始
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
//新贴
$hack_cut_str = 26; //标题字数
$hack_cut_strauthor = 9;
$new_post_threadlist = array();
$nthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.dateline DESC LIMIT 0, 10");
while($nthread = $db->fetch_array($query)) {
        $nthread['forumname'] = ereg_replace('<[^>]*>','',$nthread['name']);
        $nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
        $nthread['view_author'] = cutstr($nthread['author'],$hack_cut_strauthor);
        $nthread['date']= gmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600);
        $nthread['lastreplytime']= gmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 3600));
        if($nthread['highlight']) {
                $string = sprintf('%02d', $nthread['highlight']);
                $stylestr = sprintf('%03b', $string[0]);
                $nthread['highlight'] = 'style="';
                $nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
                $nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
                $nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
                $nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
                $nthread['highlight'] .= '"';
        } else {
                $nthread['highlight'] = '';
        }
        $new_post_threadlist[] = $nthread;
}
//新回复
$hack_cut_str = 26; //标题字数
$hack_cut_strauthor = 9;
$new_reply_threadlist = array();
$rthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid  AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.lastpost DESC LIMIT 0, 10");
while($rthread = $db->fetch_array($query)) {
        $rthread['forumname'] = ereg_replace('<[^>]*>','',$rthread['name']);
        $rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
        $rthread['view_lastposter'] = cutstr($rthread['lastposter'],$hack_cut_strauthor);
  $rthread['date']= gmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600);
        $rthread['lastreplytime']= gmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 3600));
        if($rthread['highlight']) {
                $string = sprintf('%02d', $rthread['highlight']);
                $stylestr = sprintf('%03b', $string[0]);
                $rthread['highlight'] = 'style="';
                $rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
                $rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
                $rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
                $rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
                $rthread['highlight'] .= '"';
        } else {
                $rthread['highlight'] = '';
        }
        $new_reply_threadlist[] = $rthread;
}
//热帖
$hack_cut_str = 26; //标题字数
$hack_cut_strauthor = 9;
$new_hot_threadlist = array();
$mthread = array();
$ctime=$timestamp-3600*24*7;//最后7是天数为本周  
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid  AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 AND t.dateline>$ctime AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.replies DESC LIMIT 0, 10");
while($mthread = $db->fetch_array($query)) {
        $mthread['forumname'] = ereg_replace('<[^>]*>','',$mthread['name']);
        $mthread['view_subject'] = cutstr($mthread['subject'],$hack_cut_str);
        $mthread['view_lastposter'] = cutstr($mthread['lastposter'],$hack_cut_strauthor);
  $mthread['date']= gmdate("$dateformat $timeformat", $mthread['dateline'] + $timeoffset * 3600);
        $mthread['lastreplytime']= gmdate("$dateformat $timeformat", $mthread[lastpost] + ($timeoffset * 3600));
        if($mthread['highlight']) {
                $string = sprintf('%02d', $mthread['highlight']);
                $stylestr = sprintf('%03b', $string[0]);
                $mthread['highlight'] = 'style="';
                $mthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
                $mthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
                $mthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
                $mthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
                $mthread['highlight'] .= '"';
        } else {
                $mthread['highlight'] = '';
        }
        $new_hot_threadlist[] = $mthread;
}
//----首页四格代码结束


2、discuz.htm
<!-- 首页四格代码开始 -->
<div class="mainbox forumlist" style="padding:0;">
<table cellspacing="0" cellpadding="0">
  <thead class="category">
  <tr>
   <td align="center" style="padding:0 1px 0 0"><h3>≡ 论坛图片 ≡</h3></td>
   <td align="center" style="padding:0"><h3>≡ 最新帖子 ≡</h3></td>
   <td align="center" style="padding:0 1px 0 1px"><h3>≡ 最新回复 ≡</h3></td>
   <td align="center" style="padding:0"><h3>≡ 本周热门 ≡</h3></td>
  </tr>
  </thead>
  <tr>
   <td width="25%">
    <script type="text/javascript" src="pic.php"></script>
   </td>
   <td width="25%">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
     <tr valign="top">
      <td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
      <td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat-y" width="100%">
      <!--{loop $new_post_threadlist $nthread}-->
       <!--{if $nthread[replies]}-->
        <div style="overflow: hidden;height: 20px;width: 100%;"><a href="viewthread.php?tid=$nthread[tid]" $nthread['highlight'] title='最新帖子 {LF}所在论坛: $nthread[forumname]{LF}主题标题: $nthread[subject] {LF}主题作者: $nthread[author]{LF}发表时间: $nthread[date]{LF}浏览次数: $nthread[views] 次 {LF}回复次数: $nthread[replies] 次{LF}最后回复: $nthread[lastreplytime]{LF}{lang lastpost}: $nthread[lastposter]'>$nthread[view_subject]</a></div>
                   <!--{else}-->
        <div style="overflow: hidden;height: 20px;width: 100%;"><a href="viewthread.php?tid=$nthread[tid]" $nthread['highlight'] title='最新帖子 {LF}所在论坛: $nthread[forumname]{LF}主题标题: $nthread[subject] {LF}主题作者: $nthread[author]{LF}发表时间: $nthread[date]{LF}浏览次数: $nthread[views] 次 {LF}回复次数: $nthread[replies] 次{LF}最后回复: 暂时没有回复'>$nthread[view_subject]</a></div>
       <!--{/if}-->
      <!--{/loop}-->
      </td>
     </tr>
    </table>
   </td>
   <td width="25%">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
     <tr valign="top">
      <td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
      <td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat-y" width="100%">
      <!--{loop $new_reply_threadlist $rthread}-->
       <div style="overflow: hidden;height: 20px;width: 100%;"><a href="viewthread.php?tid=$rthread[tid]" $rthread['highlight'] title='最新回复 {LF}所在论坛: $rthread[forumname]{LF}主题标题: $rthread[subject]{LF}主题作者: $rthread[author]{LF}发表时间: $rthread[date]{LF}浏览次数: $rthread[views] 次{LF}回复次数: $rthread[replies] 次{LF}最后回复: $rthread[lastreplytime]{LF}{lang lastpost}: $rthread[lastposter]'>$rthread[view_subject]</a></div>
      <!--{/loop}-->
      </td>
     </tr>
    </table>
   </td>
   <td width="25%">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
     <tr valign="top">
      <td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
      <td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat-y" width="100%">
      <!--{loop $new_hot_threadlist $mthread}-->
       <div style="overflow: hidden;height: 20px;width: 100%;"><a href="viewthread.php?tid=$mthread[tid]" $mthread['highlight'] title='本周热门 {LF}所在论坛: $mthread[forumname]{LF}主题标题: $mthread[subject]{LF}主题作者: $mthread[author]{LF}发表时间: $mthread[date]{LF}浏览次数: $mthread[views] 次{LF}回复次数: $mthread[replies] 次{LF}最后回复: $mthread[lastreplytime]{LF}{lang lastpost}: $mthread[lastposter]'>$mthread[view_subject]</a></div>
      <!--{/loop}-->
      </td>
     </tr>
    </table>
   </td>
  </tr>
</table>
</div>
<!-- 首页四格代码结束 -->


二、5.5的时候用过这个版本的四格:https://discuz.dismall.com/viewth ... p;extra=&page=1
速度很快,版面也很紧凑,效果如下图:


我曾原封不动照搬来用于6.0,发现在6.0里有以下问题:
1、表头背景没显示,影响美观;
2、标题前的小图标也没显示,都变成字母“z”了。
3、在Firefox下鼠标悬停于标题上,加了高亮的论坛板块的显示出现代码。(5.5就存在这个问题)
4、貌似没有指定板块搜索范围(包括图片和标题两部分)。
想必改进以上问题即可适用于6.0了?该怎么做??再加上详细解释就更加人性化且完美了!!
(该原版四格的flash播放图片因显示完整图片,会导致图片变形,改用现在普遍使用的四格flash播放器即可解决)

以上问题希望有大虾出手帮助,不胜感激!!

[ 本帖最后由 ggoyy 于 2007-10-4 18:33 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

微微檸檬香 发表于 2007-10-4 16:20:13 | 显示全部楼层
我装过两个首页N格的插件,分别是
https://discuz.dismall.com/thread-696558-1-1.html
https://discuz.dismall.com/thread-721806-1-1.html

我装的那个是新论坛,所以使用的都是懒人装法,直接覆盖,就不存在步骤错误。
我原本以为是风格问题,测试了一下,DZ自带的风格,FLASH一样不显示!
请问究竟是怎么回事~哭!
回复

使用道具 举报

ggoyy 发表于 2007-10-4 18:31:13 | 显示全部楼层

回复 444# 的帖子

楼上的朋友,你论坛都没有图片,怎么显示呢?

Q:为什么首页n格的图片浏览不显示?
A:这个有可能跟空间商有关,不过你先确定下你做了以下操作:在论坛的帖子内,有jpg格式的图片附件,如果这样还不行,就有可能是空间商的问题。还有,因为目前的pic.php都是用的一个文件,所以远程调用的附件可能不能显示。
延伸:让游客不能查看首页n格的图片预览。因为图片的一般都是调用的一个pic.php,所以只要在这个IFRAME的前后加一个判断即可。
回复

使用道具 举报

regoo 发表于 2007-10-6 11:49:59 | 显示全部楼层
请问一下,我下载的是首页显示五格的.可是图片那一格显不了.怎么解决...附件是不是一定要上传JPG才能显示.........网址:www.501.cc
回复

使用道具 举报

liufly 发表于 2007-10-7 21:09:03 | 显示全部楼层
大家(帮我看看为什么我的四格:附件图片不显示) 请问pic.php是放在根目录吗
什么都正常就四格附件图片不显示,大家帮忙解答一下为什么。
我发了好几个附件图片。
我的论坛:http://xmch.kmip.net
你们帮我看看解答一下,拜托了
回复

使用道具 举报

meteor8 发表于 2007-10-8 01:26:15 | 显示全部楼层
我的首页5格很正常啊,你们是怎么弄的?
http://bbs.0762.cn
回复

使用道具 举报

 楼主| TaRot! 发表于 2007-10-8 10:18:22 | 显示全部楼层

回复 437# 的帖子

默认的查询没有,可以使用JS调用.
回复

使用道具 举报

 楼主| TaRot! 发表于 2007-10-8 10:20:20 | 显示全部楼层

回复 440# 的帖子

4格的FLASH牵扯问题根据服务器不同问题也不同,建议可以试下mookey的那个JS调用替换程序调用.
回复

使用道具 举报

 楼主| TaRot! 发表于 2007-10-8 10:21:37 | 显示全部楼层

回复 442# 的帖子

PIC用这个不管用,可以按照PIC里的说明去修改.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-9-22 23:22 , Processed in 0.128317 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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