亲注册登录道勤网-可以查看更多帖子内容哦!(包涵精彩图片、文字详情等)请您及时注册登录-www.daoqin.net
您需要 登录 才可以下载或查看,没有账号?立即注册
x
discuz X3自带首页四格开启位置为:后台——论坛——首页四格。
首页四格代码展示位置:template\default\forum\discuz.htm
默认代码如下:
- <!--{if !empty($_G['setting']['grid']['showgrid'])}-->
- <!-- index four grid -->
- <div class="fl bm">
- <div class="bm bmw cl">
- <div id="category_grid" class="bm_c" >
- <table cellspacing="0" cellpadding="0"><tr>
- <!--{if !$_G['setting']['grid']['gridtype']}-->
- <td valign="top" class="category_l1">
- <div class="newimgbox">
- <h4><span class="tit_newimg"></span>{lang latest_images}</h4>
- <div class="module cl slidebox_grid" style="width:218px">
- <script type="text/javascript">
- var slideSpeed = 5000;
- var slideImgsize = [218,200];
- var slideBorderColor = '{$_G['style']['specialborder']}';
- var slideBgColor = '{$_G['style']['commonbg']}';
- var slideImgs = new Array();
- var slideImgLinks = new Array();
- var slideImgTexts = new Array();
- var slideSwitchColor = '{$_G['style']['tabletext']}';
- var slideSwitchbgColor = '{$_G['style']['commonbg']}';
- var slideSwitchHiColor = '{$_G['style']['specialborder']}';
- {eval $k = 1;}
- <!--{loop $grids['slide'] $stid $svalue}-->
- slideImgs[<!--{echo $k}-->] = '$svalue[image]';
- slideImgLinks[<!--{echo $k}-->] = '{$svalue[url]}';
- slideImgTexts[<!--{echo $k}-->] = '$svalue[subject]';
- {eval $k++;}
- <!--{/loop}-->
- </script>
- <script language="javascript" type="text/javascript" src="{$_G[setting][jspath]}forum_slide.js?{VERHASH}"></script>
- </div>
- </div>
- </td>
- <!--{/if}-->
- <td valign="top" class="category_l2">
- <div class="subjectbox">
- <h4><span class="tit_subject"></span>{lang collection_lastthread}</h4>
- <ul class="category_newlist">
- <!--{loop $grids['newthread'] $thread}-->
- <!--{if !$thread['forumstick'] && $thread['closed'] > 1 && ($thread['isgroup'] == 1 || $thread['fid'] != $_G['fid'])}-->
- <!--{eval $thread[tid]=$thread[closed];}-->
- <!--{/if}-->
- <li><a href="forum.php?mod=viewthread&tid=$thread[tid]&extra=$extra"{if $thread['highlight']} $thread['highlight']{/if}{if $_G['setting']['grid']['showtips']} tip="{lang title}: <strong>$thread[oldsubject]</strong><br/>{lang author}: $thread[author] ($thread[dateline])<br/>{lang show}/{lang reply}: $thread[views]/$thread[replies]" onmouseover="showTip(this)"{else} title="$thread[oldsubject]"{/if}{if $_G['setting']['grid']['targetblank']} target="_blank"{/if}>$thread[subject]</a></li>
- <!--{/loop}-->
- </ul>
- </div>
- </td>
- <td valign="top" class="category_l3">
- <div class="replaybox">
- <h4><span class="tit_replay"></span>{lang show_newthreads}</h4>
- <ul class="category_newlist">
- <!--{loop $grids['newreply'] $thread}-->
- <!--{if !$thread['forumstick'] && $thread['closed'] > 1 && ($thread['isgroup'] == 1 || $thread['fid'] != $_G['fid'])}-->
- <!--{eval $thread[tid]=$thread[closed];}-->
- <!--{/if}-->
- <li><a href="forum.php?mod=redirect&tid=$thread[tid]&goto=lastpost#lastpost"{if $thread['highlight']} $thread['highlight']{/if}{if $_G['setting']['grid']['showtips']}tip="{lang title}: <strong>$thread[oldsubject]</strong><br/>{lang author}: $thread[author] ($thread[dateline])<br/>{lang show}/{lang reply}: $thread[views]/$thread[replies]" onmouseover="showTip(this)"{else} title="$thread[oldsubject]"{/if}{if $_G['setting']['grid']['targetblank']} target="_blank"{/if}>$thread[subject]</a></li>
- <!--{/loop}-->
- </ul>
- </div>
- </td>
- <td valign="top" class="category_l3">
- <div class="hottiebox">
- <h4><span class="tit_hottie"></span>{lang hot_thread}</h4>
- <ul class="category_newlist">
- <!--{loop $grids['hot'] $thread}-->
- <!--{if !$thread['forumstick'] && $thread['closed'] > 1 && ($thread['isgroup'] == 1 || $thread['fid'] != $_G['fid'])}-->
- <!--{eval $thread[tid]=$thread[closed];}-->
- <!--{/if}-->
- <li><a href="forum.php?mod=viewthread&tid=$thread[tid]&extra=$extra"{if $thread['highlight']} $thread['highlight']{/if}{if $_G['setting']['grid']['showtips']} tip="{lang title}: <strong>$thread[oldsubject]</strong><br/>{lang author}: $thread[author] ($thread[dateline])<br/>{lang show}/{lang reply}: $thread[views]/$thread[replies]" onmouseover="showTip(this)"{else} title="$thread[oldsubject]"{/if}{if $_G['setting']['grid']['targetblank']} target="_blank"{/if}>$thread[subject]</a></li>
- <!--{/loop}-->
- </ul>
- </div>
- </td>
- <!--{if $_G['setting']['grid']['gridtype']}-->
- <td valign="top" class="category_l4">
- <div class="goodtiebox">
- <h4><span class="tit_goodtie"></span>{lang post_digest_thread}</h4>
- <ul class="category_newlist">
- <!--{loop $grids['digest'] $thread}-->
- <!--{if !$thread['forumstick'] && $thread['closed'] > 1 && ($thread['isgroup'] == 1 || $thread['fid'] != $_G['fid'])}-->
- <!--{eval $thread[tid]=$thread[closed];}-->
- <!--{/if}-->
- <li><a href="forum.php?mod=viewthread&tid=$thread[tid]&extra=$extra"{if $thread['highlight']} $thread['highlight']{/if}{if $_G['setting']['grid']['showtips']} tip="{lang title}: <strong>$thread[oldsubject]</strong><br/>{lang author}: $thread[author] ($thread[dateline])<br/>{lang show}/{lang reply}: $thread[views]/$thread[replies]" onmouseover="showTip(this)"{else} title="$thread[oldsubject]"{/if}{if $_G['setting']['grid']['targetblank']} target="_blank"{/if}>$thread[subject]</a></li>
- <!--{/loop}-->
- </ul>
- </div>
- </td>
- <!--{/if}-->
- </table>
- </div>
- </div>
- </div>
- <!-- index four grid end -->
- <!--{/if}-->
复制代码 以上个别代码说明:
- {eval $k = 1;}
- <!--{loop $grids['slide'] $stid $svalue}-->
- slideImgs[<!--{echo $k}-->] = '$svalue[image]';
- slideImgLinks[<!--{echo $k}-->] = '{$svalue[url]}';
- slideImgTexts[<!--{echo $k}-->] = '$svalue[subject]';
- {eval $k++;}
复制代码 表示图片幻灯片从1开始,有一个幻灯片就会加1,这样会一直循环下去。比如只想显示5张幻灯图片,把$k++改成$k = 5即可
- var slideSpeed = 5000;
- var slideImgsize = [218,200];
复制代码- /* 论坛首页四格 by Alice */
- #category_grid { padding: 0; border-top:1px solid {COMMONBORDER}; }
- #category_grid table { width:100%;table-layout: fixed; }
- #category_grid td { width: 25%; }
- .category_l1, .category_l2, .category_l3, .category_l4 { line-height: 25px; background: #fff; overflow: hidden; }
- .category_l1 { line-height: normal; }
- .category_l1, .category_l2, .category_l3 { background: url({IMGDIR}/category_lbg.png) no-repeat right center; }
- .ie6 .category_l4 { margin-right: -3px; }
- .slidebox_grid { position: relative; margin: 10px; border: 1px #ccc solid; }
- #category_grid h4 { width:100%; height: 30px; line-height: 30px; text-indent:10px; font-size: 12px; cursor: pointer; background: url({IMGDIR}/tb.png) repeat-x; position:relative; }
- .category_newlist { padding: 10px; }
- .category_newlist li { background:url({IMGDIR}/dot.gif) no-repeat left center; height: 21px; line-height:21px; overflow: hidden; padding-left:10px; }
- #category_grid h4 span { background:#CDCDCD; width:1px; height:30px; display:inline-block; position:absolute; left:0; top:0; }
- #category_grid h4 span.tit_newimg { background:#FFF; }
- #category_grid .newimgbox:hover h4 span, #category_grid .subjectbox:hover h4 span, #category_grid .replaybox:hover h4 span, #category_grid .hottiebox:hover h4 span, #category_grid .goodtiebox:hover h4 span { width:6px; background:url({IMGDIR}/grid.png) no-repeat 0 0;transition:width 0.2s ease 0s; overflow:hidden; }
- #category_grid .newimgbox:hover h4 span.tit_newimg { background-position:0 -30px; }
- #category_grid .subjectbox:hover h4 span.tit_subject { background-position:0 0; }
- #category_grid .repalybox:hover h4 span.tit_replay { background-position:0 -30px; }
- #category_grid .hottiebox:hover h4 span.tit_hottie { background-position:0 -60px; }
- #category_grid .goodtiebox:hover h4 span.tit_goodtie { background-position:0 -90px; }
复制代码- $grids['slide'][$ithread['tid']] = array(
- 'image' => $imageurl,
- 'url' => 'forum.php?mod=viewthread&tid='.$ithread['tid'],
- 'subject' => $ithread['subject']
- );
复制代码 在上面代码下面增加:
即修改成如下所示代码:
- $grids['slide'][$ithread['tid']] = array(
- 'image' => $imageurl,
- 'url' => 'forum.php?mod=viewthread&tid='.$ithread['tid'],
- 'subject' => $ithread['subject']
- );
- rsort($grids['slide']);
- }
- }
- $grids['cachetime'] = TIMESTAMP;
复制代码解决X3自带首页四格最新主题和最新回复一样的问题 由于source\class\table\table_forum_thread.php文件中调用新主题的参数是 newthread,第1105行 - if($type == 'newthread') {
复制代码而source\module\forum\forum_index.php里却是thread,所以默认还是调用的最新回复贴子 - $grids['newthread'] = C::t('forum_thread')->fetch_all_for_guide('thread', 0, array(), 0, 0, 0, 10, $_G['setting']['grid']['fids']);
复制代码修改 thread为newthread即可,如下第159行 - $grids['newthread'] = C::t('forum_thread')->fetch_all_for_guide('newthread', 0, array(), 0, 0, 0, 10, $_G['setting']['grid']['fids']);
复制代码修改图片逆序的代码是这么改的:找到 - $grids['image'] = C::t('forum_thread')->fetch_all_by_tid($tids);
复制代码在下面加上一个多维数组排序的代码如下: - $grids['image'] = C::t('forum_thread')->fetch_all_by_tid($tids);
- //进行一次排序
- foreach($grids['image'] as $tmpkey => $tmpvalue){
- $tmpkeys[]=$tmpkey;
- }
- array_multisort($tmpkeys,SORT_DESC,$grids['image']); //试试能不能排序
复制代码因为php的这个array_multisort虽然会修改key的值,但是其实dz根本不用,图片显示的完全正常
道勤主机提供365天*24小时全年全天无休、实时在线、零等待的售后技术支持。竭力为您免费处理您在使用道勤主机过程中所遇到的一切问题!
如果您是道勤主机用户,那么您可以通过QQ【792472177】、售后QQ【59133755】、旺旺【诠释意念】、微信:q792472177免费电话、后台提交工单这些方式联系道勤主机客服!
如果您不是我们的客户也没问题,点击页面最右边的企业QQ在线咨询图标联系我们并购买后,我们为您免费进行无缝搬家服务,让您享受网站零访问延迟的迁移到道勤主机的服务! |