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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

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

[复制链接]
习明 发表于 2008-6-11 23:00:58 | 显示全部楼层

回复 780# i014 的帖子

是用DZ自带的数据调用?
回复

使用道具 举报

i014 发表于 2008-6-12 14:47:23 | 显示全部楼层
  1. <script language="javascript">
  2. function view(a) {
  3. document.getElementById('top1').style.display='none';
  4. document.getElementById('top2').style.display='none';
  5. document.getElementById('top3').style.display='none';


  6. document.getElementById('top'+a).style.display='block';

  7. document.getElementById('tab1').className='';
  8. document.getElementById('tab2').className='';
  9. document.getElementById('tab3').className='';


  10. document.getElementById('tab'+a).className='current';
  11. }
  12. </script>
  13. <div id="blank" style="height:250px">
  14. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  15.   <tr>
  16.     <td style="padding-right:5px"><div id="hotarticle" style="width:350px; float:left; height:259px">
  17.                         <p id="hotarticletabs">
  18.                        
  19.                         <span id="rggtab" onMouseOver="setTab('hotarticle','rgg')" style="margin-right:0px">         <img src="{IMGDIR}/a04.gif" align="absmiddle"/>社区公告 </span>
  20.                        
  21.                         <span id="rjstab" onMouseOver="setTab('hotarticle','rjs')">
  22.                 <img src="{IMGDIR}/a03.gif" align="absmiddle"/>快速登陆</span>
  23.                        
  24.                         <span id="rhdtab" class="active" onMouseOver="setTab('hotarticle','rhd')">  <img src="{IMGDIR}/a02.gif" align="absmiddle"/>社区图片 </span>
  25.                        
  26.                         </p>
  27.                        
  28.                         <h3 style="margin-left:1px"> </h3>
  29.                         <ul id="rhd" class="tabcontent" style="border:1px solid #e0e0e0; border-top:none;margin-left:1px; height:195px";>
  30. <script type="text/javascript" src="pic.php"></script>
  31.                         </ul>
  32.                         <ul id="rjs" class="tabcontent" style="display: none;border:1px solid #e0e0e0; border-top:none;margin-left:1px; height:195px";>
  33. {template index_dl}
  34.                         </ul>
  35.                         <ul id="rgg" class="tabcontent" style="display: none;border:1px solid #e0e0e0; border-top:none;margin-left:1px; height:195px";>

  36. {template index_gg}
  37.                         </ul>
  38.         </div></td>
  39. <td width="100%">
  40. <div style="float:left; height:auto; padding-top:0px; width:100%">
  41. <table  align="left" width="100%" border="0" cellpadding="0" >
  42. <tr>
  43.                            <td style="padding: 0px 0px 0px 5px">
  44.                                 <div class="mainbox">
  45.                                         <ul class="tabs">
  46.                                                 <li id="tab1" class="current" ><span style="padding:0 10px;" onMouseOver="javascript:view(1);">最新主题</span></li>
  47.                                                 <li id="tab2" class="" ><span style="padding:0 10px;" onMouseOver="javascript:view(2);">最新回复</span></li>
  48.                                                 <li id="tab3" class="" ><span style="padding:0 10px;" onMouseOver="javascript:view(3);">本周热门</span></li>

  49.                                         </ul>
  50.                                 <table border="0" cellpadding="0" cellspacing="0" width="100%">
  51.                                         <tr valign="top">
  52.                                                 <td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
  53.                                                 <td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat" width="100%">
  54.                                                 <div id="top1" style="display:block;">
  55.                                                 <!--{loop $new_post_threadlist $nthread}-->
  56.                                                 <!--{if $nthread[replies]}-->
  57.                                                         <div style="overflow: hidden;height: 20px;width: 98%;"><em style="float:right; padding-top:2px;"><a href="space.php?uid=$nthread[authorid]" title="查看$nthread[author]的个人空间" target="_blank">$nthread[author]</a></em><span style="float:left;"><a href="viewthread.php?tid=$nthread[tid]" $nthread['highlight'] title='最新主题 {LF}所在论坛: $nthread[forumname]{LF}主题标题: {echo strip_tags($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></span></div><div style="clear:both;"></div>
  58.                                                 <!--{else}-->
  59.                                                         <div style="overflow: hidden;height: 20px;width: 98%;"><em style="float:right; padding-top:2px;"><a href="space.php?uid=$nthread[authorid]" title="查看$nthread[author]的个人空间" target="_blank">$nthread[author]</a></em><span style="float:left;"><a href="viewthread.php?tid=$nthread[tid]" $nthread['highlight'] title='最新主题 {LF}所在论坛: $nthread[forumname]{LF}主题标题: {echo strip_tags($nthread[subject])} {LF}主题作者: $nthread[author]{LF}发表时间: $nthread[date]{LF}浏览次数: $nthread[views] 次 {LF}回复次数: $nthread[replies] 次{LF}最后回复: 暂时没有回复'>$nthread[view_subject]</a></span></div><div style="clear:both;"></div>
  60.                                                 <!--{/if}-->
  61.                                                 <!--{/loop}-->
  62.                                                 </div>
  63.                                                 <div id="top2" style="display:none;">
  64.                                                 <!--{loop $new_reply_threadlist $rthread}-->
  65.                                                 <div style="overflow: hidden;height: 20px;width: 98%;"><em style="float:right; padding-top:2px;"><a href="space.php?uid=$rthread[lastposterid]" title="查看$rthread[lastposter]的个人空间" target="_blank">$rthread[lastposter]</a></em><span style="float:left;"><a href="redirect.php?tid=$rthread[tid]&goto=lastpost#lastpost" $rthread['highlight'] title='最新回复 {LF}所在论坛: $rthread[forumname]{LF}主题标题: {echo strip_tags($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></span></div><div style="clear:both;"></div>
  66.                                                 <!--{/loop}-->
  67.                                                 </div>
  68.                                                 <div id="top3" style="display:none;">
  69.                                                 <!--{loop $new_hot_threadlist $mthread}-->
  70.                                                 <div style="overflow: hidden;height: 20px;width: 98%;"><em style="float:right; padding-top:2px;"><a href="space.php?uid=$mthread[authorid]" title="查看$mthread[author]的个人空间" target="_blank">$mthread[author]</a></em><span style="float:left;"><a href="viewthread.php?tid=$mthread[tid]" $mthread['highlight'] title='本周热门 {LF}所在论坛: $mthread[forumname]{LF}主题标题: {echo strip_tags($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></span></div><div style="clear:both;"></div>
  71.                                                 <!--{/loop}-->
  72.                                                 </div>
  73.                                     </table>
  74.                                 </div>
  75.                         </td>

  76. <td width="40%" style="padding: 0px 0px 0px 10px ; " >
  77. <div class="sgright">
  78. <iframe src="templates/default/acdsnew.htm"; width=250px height=250px align="center"
  79. marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe>
  80. </div></td></tr></table></div></td>
  81.   </tr>
  82. </table>
  83. </div>
复制代码
这是 discuz.htm  中新增加的插件代码!
  1. <?php

  2. //---设置---start

  3. $cachelife        = 1800;//缓存时间.
  4. $cachename        = DISCUZ_ROOT.'./forumdata/cache/cache_showother.php';//缓存名.若与何插件冲突请修改,只要不冲突不会影响使用.

  5. if(@!include($cachename) || @filemtime($cachename) + $cachelife > $timestamp) {
  6.         require_once './include/common.inc.php';
  7. require_once DISCUZ_ROOT.'./include/cache.func.php';
  8. $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');


  9. //新贴
  10. $hack_cut_str = 29; //标题字数
  11. $hack_cut_strauthor = 5;
  12. $new_post_threadlist = array();
  13. $nthread = array();
  14. $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 (54,55,56,57,58) AND t.displayorder not in (-1,-2) ORDER BY t.dateline DESC LIMIT 0, 10");
  15. while($nthread = $db->fetch_array($query)) {
  16.         $nthread['forumname'] = ereg_replace('<[^>]*>','',$nthread['name']);
  17.         $nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
  18.         $nthread['view_author'] = cutstr($nthread['author'],$hack_cut_strauthor);
  19.         $nthread['date']= gmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600);
  20.         $nthread['lastreplytime']= gmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 3600));
  21.         if($nthread['highlight']) {
  22.                 $string = sprintf('%02d', $nthread['highlight']);
  23.                 $stylestr = sprintf('%03b', $string[0]);
  24.                 $nthread['highlight'] = 'style="';
  25.                 $nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  26.                 $nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  27.                 $nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  28.                 $nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  29.                 $nthread['highlight'] .= '"';
  30.         } else {
  31.                 $nthread['highlight'] = '';
  32.         }
  33.         $new_post_threadlist[] = $nthread;
  34. }
  35. $curdata = "\$new_post_threadlist = ".arrayeval($new_post_threadlist).";\n\n";




  36. //新回复
  37. $hack_cut_str = 29; //标题字数
  38. $hack_cut_strauthor = 6;
  39. $new_reply_threadlist = array();
  40. $rthread = array();
  41. $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 (54,55,56,57,58) AND t.displayorder not in (-1,-2) AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 10");
  42. while($rthread = $db->fetch_array($query)) {
  43.         $rthread['forumname'] = ereg_replace('<[^>]*>','',$rthread['name']);
  44.         $rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
  45.         $rthread['view_lastposter'] = cutstr($rthread['lastposter'],$hack_cut_strauthor);
  46.         $rthread['date']= gmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600);
  47.         $rthread['lastreplytime']= gmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 3600));
  48.         if($rthread['highlight']) {
  49.                 $string = sprintf('%02d', $rthread['highlight']);
  50.                 $stylestr = sprintf('%03b', $string[0]);
  51.                 $rthread['highlight'] = 'style="';
  52.                 $rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  53.                 $rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  54.                 $rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  55.                 $rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  56.                 $rthread['highlight'] .= '"';
  57.         } else {
  58.                 $rthread['highlight'] = '';
  59.         }
  60.         $new_reply_threadlist[] = $rthread;
  61. }
  62. $curdata .= "\$new_reply_threadlist = ".arrayeval($new_reply_threadlist).";\n\n";




  63. //热门
  64. $hack_cut_str = 29; //标题字数
  65. $hack_cut_strauthor = 6;
  66. $new_hot_threadlist = array();
  67. $mthread = array();
  68. $ctime=$timestamp-3600*24*7;//最后7是天数为本周  
  69. $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 (54,55,56,57,58) AND t.displayorder not in (-1,-2) ORDER BY t.replies DESC LIMIT 0, 10");
  70. while($mthread = $db->fetch_array($query)) {
  71.         $mthread['forumname'] = ereg_replace('<[^>]*>','',$mthread['name']);
  72.         $mthread['view_subject'] = cutstr($mthread['subject'],$hack_cut_str);
  73.         $mthread['view_lastposter'] = cutstr($mthread['lastposter'],$hack_cut_strauthor);
  74.        
  75.         $mthread['lastreplytime']= gmdate("$dateformat $timeformat", $mthread[lastpost] + ($timeoffset * 3600));
  76.         if($mthread['highlight']) {
  77.                 $string = sprintf('%02d', $mthread['highlight']);
  78.                 $stylestr = sprintf('%03b', $string[0]);
  79.                 $mthread['highlight'] = 'style="';
  80.                 $mthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  81.                 $mthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  82.                 $mthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  83.                 $mthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  84.                 $mthread['highlight'] .= '"';
  85.         } else {
  86.                 $mthread['highlight'] = '';
  87.         }
  88.         $new_hot_threadlist[] = $mthread;
  89. }





  90. $curdata .= "\$new_hot_threadlist = ".arrayeval($new_hot_threadlist).";\n\n";

  91.         writetocache("showother", '', $curdata);
  92.         include $cachename;
  93. }


  94. ?>
复制代码
这是index.php新增调用  @include DISCUZ_ROOT.'./index_four.php';      index_four.php 这个文件中的内容。


给你回完帖后 自己仔细看 才发现了   语句中的  f.fid NOT IN (54,55,56,57,58) AND t.displayorder not in (-1,-2)  这句话  不好意思 是我粗心了。我先调试一下!!!

不太明白  t.displayorder  这个语句是什么意思?

[ 本帖最后由 i014 于 2008-6-12 14:58 编辑 ]
回复

使用道具 举报

习明 发表于 2008-6-12 15:02:56 | 显示全部楼层

回复 784# i014 的帖子

不读取待审主题和回收站中的主题
回复

使用道具 举报

panda08 发表于 2008-6-12 15:47:33 | 显示全部楼层

回复781

我看到那个帖子了,可是我知道具体在哪个文件,哪个地方增加AND f.fid NOT IN (1,2),请指教
回复

使用道具 举报

i014 发表于 2008-6-13 12:10:37 | 显示全部楼层

回复 786# panda08 的帖子

$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 (54,55,56,57,58) AND t.displayorder not in (-1,-2) ORDER BY t.dateline DESC LIMIT 0, 10");


楼上的 我学会了  帮楼主分担一下  
你可以参考一下  以上语句  就应该可以明白加在那里了~!~
回复

使用道具 举报

百事可乐2007 发表于 2008-6-13 13:50:13 | 显示全部楼层
楼主辛苦~我来学习
回复

使用道具 举报

就这样 发表于 2008-6-13 16:35:49 | 显示全部楼层
再次看再次有收获!
回复

使用道具 举报

s133 发表于 2008-6-25 11:17:59 | 显示全部楼层
我用的是https://discuz.dismall.com/thread-696558-1-2.html的首页五格,图片不显示。求助
回复

使用道具 举报

1908765 发表于 2008-6-28 10:00:54 | 显示全部楼层
呵呵  我傻了‘~~哈哈
回复

使用道具 举报

安啦北北 发表于 2008-6-30 23:14:04 | 显示全部楼层
我的也是五格图片不显示的问题.刚才按照顶楼的替换了代码,但还是没有用.

我把PIC.PHP发上来,请您给看一下?



<?php
/*
design by Clement
change by xuon
*/
//---设置---start
$shownums = 5;//演示个数 6以内
$searchnums = 50;//搜索总数
$cachelife = 1800;//缓存时间
$orderby = 'dateline';//搜索顺序:按日期dateline/按浏览次数downloads/随机rand
$cachename = 'showpic';//缓存名.若与何插件冲突请修改,只要不冲突不会影响使用.
$searchfid = '';//搜索fid范围.不限制留空.请用逗号相隔,如'1,2,3'
//---设置---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/jpeg' OR 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++;
}
?>
var swf_width=260
var swf_height=198
var config='5|0xffffff|0x0099ff|50|0xffffff|0x0099ff|0x000000'
// config 设置分别为: 自动播放时间(秒)|文字颜色|文字背景色|文字背景透明度|按键数字色|当前按键色|普通按键色
var files='<?php echo $showpicpics;?>'
var links='<?php echo $showpiclinks;?>'
var texts='<?php echo $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" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="menu" value="false" />');
document.write('<param name=wmode value="opaque" />');
document.write('<param name="FlashVars" value="config='+config+'&bcastr_flie='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'" />');
document.write('<embed src="images/focus.swf" wmode="opaque" FlashVars="config='+config+'&bcastr_flie='+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>');
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-22 12:47 , Processed in 0.104221 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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