Discuz教程网

Discuz官方图片区瀑布流的x2.5修改方法

[复制链接]
authicon dly 发表于 2012-7-6 08:46:53 | 显示全部楼层 |阅读模式
看见官方区很多同学都问其他模板里面可以使用Discuz官方图片区瀑布流吗?答案是可以的,下载我们分享下X2.5修改和实现的方法

一、打开你使用的模板下common目录中的common.css或者extend_common.css,在最下面添加
  1. /* 瀑布流布局 by Pony 站帮网(www.zhanhelp.com)提供 */
  2. .waterfall { position: relative; margin-top: 15px; }
  3. .waterfall li { margin: 0 10px 10px 0; padding: 0 0 3px; text-align: left; border-width: 1px 0 0; border-top: 1px solid #EAEAEA; background: url({STYLEIMGDIR}/bg_waterfall.png) no-repeat 100% 100%; }
  4. .waterfall .c, .waterfall h3 { padding: 10px; border: solid #EAEAEA; border-width: 0 1px; background-color: #F8F8F8; }
  5. .waterfall .c { overflow: hidden; padding-bottom: 0; max-height: 800px; }
  6. .waterfall .c .nopic { display: block; background:{WRAPBG} url({IMGDIR}/nophototiny.png) no-repeat 50% 50%; cursor: pointer; }
  7. .waterfall .auth { padding: 0 10px 10px; border-width: 0 1px 1px; border-style: solid; border-color: transparent #EAEAEA #B9B9B9; background: #F8F8F8; }
  8. .waterfall .auth img { display: inline-block; margin: 0 1px; }
复制代码

二、打开使用模板中的forum目录下的forumdisplay_list.htm文件,查找代码
  1. <ul class="ml mlt mtw cl">
  2. <!--{loop $_G['forum_threadlist'] $key $thread}-->
  3. <!--{if !$thread['forumstick'] && ($thread['isgroup'] == 1 || $thread['fid'] != $_G['fid'])}-->
  4. <!--{if $thread['related_group'] == 0 && $thread['closed'] > 1}-->
  5. <!--{eval $thread[tid]=$thread[closed];}-->
  6. <!--{/if}-->
  7. <!--{/if}-->
  8. <li style="width:{$_G[setting][forumpicstyle][thumbwidth]}px;">
  9. <!--{if !$_GET['archiveid'] && $_G['forum']['ismoderator']}-->
  10. <div style="position: absolute;padding:2px;background:#FFF">
  11. <!--{if $thread['fid'] == $_G[fid]}-->
  12. <!--{if $thread['displayorder'] <= 3 || $_G['adminid'] == 1}-->
  13. <input onclick="tmodclick(this)" type="checkbox" name="moderate[]" value="$thread[tid]" />
  14. <!--{else}-->
  15. <input type="checkbox" disabled="disabled" />
  16. <!--{/if}-->
  17. <!--{else}-->
  18. <input type="checkbox" disabled="disabled" />
  19. <!--{/if}-->
  20. </div>
  21. <!--{/if}-->
  22. <div class="c cl">
  23. <a href="forum.php?mod=viewthread&tid=$thread[tid]&{if $_GET['archiveid']}archiveid={$_GET['archiveid']}&{/if}extra=$extra" {if $thread['isgroup'] == 1 || $thread['forumstick'] || CURMODULE == 'guide'} target="_blank"{else} onclick="atarget(this)"{/if} title="$thread[subject]" class="z">
  24. <!--{if $thread['cover']}-->
  25. <img src="$thread[coverpath]" alt="$thread[subject]" width="{$_G[setting][forumpicstyle][thumbwidth]}" height="{$_G[setting][forumpicstyle][thumbheight]}" />
  26. <!--{else}-->
  27. <span class="nopic" style="width:{$_G[setting][forumpicstyle][thumbwidth]}px; height:{$_G[setting][forumpicstyle][thumbheight]}px;"></span>
  28. <!--{/if}-->
  29. </a>
  30. </div>
  31. <h3 class="ptn" style="width: {$_G[setting][forumpicstyle][thumbwidth]}px;">
  32. <!--{hook/forumdisplay_thread $key}-->
  33. <!--{if in_array($thread['displayorder'], array(1, 2, 3, 4))}--><em class="sum pin">{lang thread_stick}</em> <!--{/if}--><!--{if in_array($thread['digest'], array(1, 2, 3))}--><em class="sum digest">{lang thread_digest}</em> <!--{/if}--><a href="forum.php?mod=viewthread&tid=$thread[tid]&{if $_GET['archiveid']}archiveid={$_GET['archiveid']}&{/if}extra=$extra"$thread[highlight]{if $thread['isgroup'] == 1 || $thread['forumstick']} target="_blank"{else} onclick="atarget(this)"{/if} title="$thread[subject]">$thread[subject]</a>
  34. </h3>
  35. <div class="cl">
  36. <!--{hook/forumdisplay_author $key}-->
  37. <!--{if $thread['cover']}--><em class="sum y xs0 xi1 xw1" title="$thread[cover] {lang pics}">$thread[cover]</em><!--{/if}-->
  38. <!--{if $thread['authorid'] && $thread['author']}-->
  39. <a href="home.php?mod=space&uid=$thread[authorid]">$thread[author]</a><!--{if !empty($verify[$thread['authorid']])}--> $verify[$thread[authorid]]<!--{/if}-->
  40. <!--{else}-->
  41. $_G[setting][anonymoustext]
  42. <!--{/if}-->
  43. </div>
  44. <div class="cl">
  45. <em class="y xs0"><a href="forum.php?mod=viewthread&tid=$thread[tid]&extra=$extra" class="xi2" title="$thread[replies] {lang reply}">$thread[replies]</a> / <em title="{if $thread['isgroup'] != 1}$thread[views]{else}{$groupnames[$thread[tid]][views]}{/if} {lang show}"><!--{if $thread['isgroup'] != 1}-->$thread[views]<!--{else}-->{$groupnames[$thread[tid]][views]}<!--{/if}--></em></em>
  46. <em class="xs0{if $thread['istoday']} xi1{/if}">$thread[dateline]</em>
  47. </div>
  48. </li>
  49. <!--{/loop}-->
  50. </ul>
复制代码

修改代替为 [code]<ul id="waterfall" class="ml waterfall cl">
<!--{loop $_G['forum_threadlist'] $key $thread}-->
<!--{if !$thread['forumstick'] && ($thread['isgroup'] == 1 || $thread['fid'] != $_G['fid'])}-->
<!--{if $thread['related_group'] == 0 && $thread['closed'] > 1}-->
<!--{eval $thread[tid]=$thread[closed];}-->
<!--{/if}-->
<!--{/if}-->
<!--{eval $waterfallwidth = $_G[setting][forumpicstyle][thumbwidth] + 24; }-->
<li style="width:{$waterfallwidth}px;">
<!--{if !$_GET['archiveid'] && $_G['forum']['ismoderator']}-->
<div style="position:absolute;margin:1px;padding:2px;background:#FFF">
<!--{if $thread['fid'] == $_G[fid]}-->
<!--{if $thread['displayorder'] <= 3 || $_G['adminid'] == 1}-->
<input onclick="tmodclick(this)" type="checkbox" name="moderate[]" value="$thread[tid]" />
<!--{else}-->
<input type="checkbox" disabled="disabled" />
<!--{/if}-->
<!--{else}-->
<input type="checkbox" disabled="disabled" />
<!--{/if}-->
</div>
<!--{/if}-->
<div class="c cl">
<a href="forum.php?mod=viewthread&tid=$thread[tid]&{if $_GET['archiveid']}archiveid={$_GET['archiveid']}&{/if}extra=$extra" {if $thread['isgroup'] == 1 || $thread['forumstick'] || CURMODULE == 'guide'} target="_blank"{else} onclick="atarget(this)"{/if} title="$thread[subject]" class="z">
<!--{if $thread['cover']}-->
<img src="$thread[coverpath]" alt="$thread[subject]" width="{$_G[setting][forumpicstyle][thumbwidth]}" />
<!--{else}-->
<span class="nopic" style="width:{$_G[setting][forumpicstyle][thumbwidth]}px; height:{$_G[setting][forumpicstyle][thumbwidth]}px;"></span>
<!--{/if}-->
</a>
</div>
<h3 class="xw0">
<!--{hook/forumdisplay_thread $key}-->
<a href="forum.php?mod=viewthread&tid=$thread[tid]&{if $_GET['archiveid']}archiveid={$_GET['archiveid']}&{/if}extra=$extra"$thread[highlight]{if $thread['isgroup'] == 1 || $thread['forumstick']} target="_blank"{else} onclick="atarget(this)"{/if} title="$thread[subject]">$thread[subject]</a>
</h3>
<div class="auth cl">
<cite class="xg1 y">
{echo '喜欢'}: <!--{if $thread[recommends]}-->$thread[recommends]<!--{else}-->0<!--{/if}-->
  {lang reply}: <a href="forum.php?mod=viewthread&tid=$thread[tid]&extra=$extra" title="$thread[replies] {lang reply}">$thread[replies]</a>
</cite>
<!--{hook/forumdisplay_author $key}-->
<!--{if $thread['authorid'] && $thread['author']}-->
<a href="home.php?mod=space&uid=$thread[authorid]">$thread[author]</a><!--{if !empty($verify[$thread['authorid']])}--> $verify[$thread[authorid]]<!--{/if}-->
<!--{else}-->
$_G[setting][anonymoustext]
<!--{/if}-->
</div>
</li>
<!--{/loop}-->
</ul>
<div id="tmppic" style="display: none;"></div>
<script type="text/javascript" src="static/js/redef.js?{VERHASH}"></script>
<script type="text/javascript" reload="1">
var wf = {};

_attachEvent(window, "load", function () {
if($("waterfall")) {
wf = waterfall();
}

<!--{if $page < $_G['page_next'] && !$subforumonly}-->
var page = $page + 1,
maxpage = $page + 10,
stopload = 0,
scrolltimer = null,
tmpelems = [],
tmpimgs = [],
markloaded = [],
imgsloaded = 0,
loadready = 0,
showready = 1,
nxtpgurl = 'https://www.discuz.1314study.com/forum.php?mod=forumdisplay&fid={$_G[fid]}&filter={$filter}&orderby={$_GET[orderby]}{$forumdisplayadd



上一篇:手动添加uc应用提示notelist where closed=0 AND app1&lt;1
下一篇:Discuz x2.5 分类信息制作教程
authicon 我看你往哪儿跑 发表于 2012-7-10 07:30:32 | 显示全部楼层
这个真的还蛮还好的呀!
authicon 划船听雨 发表于 2012-8-12 11:51:20 | 显示全部楼层
不错,能省不少钱,要是管用的话
authicon 宿迁 发表于 2012-8-19 19:11:39 | 显示全部楼层
让房价涨的再猛烈一些吧!
authicon 大地大规模23 发表于 2012-9-18 19:56:44 | 显示全部楼层
<ul id="waterfall" class="ml waterfall cl">
<!--{loop $_G['forum_threadlist'] $key $thread}-->
<!--{if !$thread['forumstick'] && ($thread['isgroup'] == 1 || $thread['fid'] != $_G['fid'])}-->
<!--{if $thread['related_group'] == 0 && $thread['closed'] > 1}-->
<!--{eval $thread[tid]=$thread[closed];}-->
<!--{/if}-->
<!--{/if}-->
<!--{eval $waterfallwidth = $_G[setting][forumpicstyle][thumbwidth] + 24; }-->
<li style="width:{$waterfallwidth}px;">
<!--{if !$_GET['archiveid'] && $_G['forum']['ismoderator']}-->
<div style="position:absolute;margin:1px;padding:2px;background:#FFF">
<!--{if $thread['fid'] == $_G[fid]}-->
<!--{if $thread['displayorder'] <= 3 || $_G['adminid'] == 1}-->
<input onclick="tmodclick(this)" type="checkbox" name="moderate[]" value="$thread[tid]" />
<!--{else}-->
<input type="checkbox" disabled="disabled" />
<!--{/if}-->
<!--{else}-->
<input type="checkbox" disabled="disabled" />
<!--{/if}-->
</div>
<!--{/if}-->
<div class="c cl">
<a href="forum.php?mod=viewthread&tid=$thread[tid]&{if $_GET['archiveid']}archiveid={$_GET['archiveid']}&{/if}extra=$extra" {if $thread['isgroup'] == 1 || $thread['forumstick'] || CURMODULE == 'guide'} target="_blank"{else} onclick="atarget(this)"{/if} title="$thread[subject]" class="z">
<!--{if $thread['cover']}-->
<img src="$thread[coverpath]" alt="$thread[subject]" width="{$_G[setting][forumpicstyle][thumbwidth]}" />
<!--{else}-->
<span class="nopic" style="width:{$_G[setting][forumpicstyle][thumbwidth]}px; height:{$_G[setting][forumpicstyle][thumbwidth]}px;"></span>
<!--{/if}-->
</a>
</div>
<h3 class="xw0">
<!--{hook/forumdisplay_thread $key}-->
<a href="forum.php?mod=viewthread&tid=$thread[tid]&{if $_GET['archiveid']}archiveid={$_GET['archiveid']}&{/if}extra=$extra"$thread[highlight]{if $thread['isgroup'] == 1 || $thread['forumstick']} target="_blank"{else} onclick="atarget(this)"{/if} title="$thread[subject]">$thread[subject]</a>
</h3>
<div class="auth cl">
<cite class="xg1 y">
{echo '喜欢'}: <!--{if $thread[recommends]}-->$thread[recommends]<!--{else}-->0<!--{/if}-->
  {lang reply}: <a href="forum.php?mod=viewthread&tid=$thread[tid]&extra=$extra" title="$thread[replies] {lang reply}">$thread[replies]</a>
</cite>
<!--{hook/forumdisplay_author $key}-->
<!--{if $thread['authorid'] && $thread['author']}-->
<a href="home.php?mod=space&uid=$thread[authorid]">$thread[author]</a><!--{if !empty($verify[$thread['authorid']])}--> $verify[$thread[authorid]]<!--{/if}-->
<!--{else}-->
$_G[setting][anonymoustext]
<!--{/if}-->
</div>
</li>
<!--{/loop}-->
</ul>
<div id="tmppic" style="display: none;"></div>
<script type="text/javascript" src="static/js/redef.js?{VERHASH}"></script>
<script type="text/javascript" reload="1">
var wf = {};

_attachEvent(window, "load", function () {
if($("waterfall")) {
wf = waterfall();
}

<!--{if $page < $_G['page_next'] && !$subforumonly}-->
var page = $page + 1,
maxpage = $page + 10,
stopload = 0,
scrolltimer = null,
tmpelems = [],
tmpimgs = [],
markloaded = [],
imgsloaded = 0,
loadready = 0,
showready = 1,
nxtpgurl = 'https://www.discuz.1314study.com/forum.php?mod=forumdisplay&fid={$_G[fid]}&filter={$filter}&orderby={$_GET[orderby]}{$forumdisplayadd}&page=',
wfloading = "<img src=\"{IMGDIR}/loading.gif\" alt=\"\" width=\"16\" height=\"16\" class=\"vm\" /> 加载中...",
pgbtn = $("pgbtn").getElementsByTagName("a")[0];

function loadmore() {
var url = nxtpgurl + page + '&t=' + parseInt((+new Date()/1000)/(Math.random()*1000));
var x = new Ajax("HTML");
x.get(url, function (s) {
s = s.replace(/\n|\r/g, "");
if(s.indexOf("id=\"pgbtn\"") == -1) {
$("pgbtn").style.display = "none";
stopload++;
window.**croll = null;
}

s = s.substring(s.indexOf("<ul id=\"waterfall\""), s.indexOf("<div id=\"tmppic\""));
s = s.replace("id=\"waterfall\"", "");
$("tmppic").innerHTML = s;
loadready = 1;
});
}

window.**croll = function () {
if(scrolltimer == null) {
scrolltimer = setTimeout(function () {
try {
if(page < maxpage && stopload < 2 && showready && ((document.documentElement.scrollTop || document.body.scrollTop) + document.documentElement.clientHeight + 500) >= document.documentElement.scrollHeight) {
pgbtn.innerHTML = wfloading;
loadready = 0;
showready = 0;
loadmore();
tmpelems = $("tmppic").getElementsByTagName("li");
var waitingtimer = setInterval(function () {
stopload >= 2 && clearInterval(waitingtimer);
if(loadready && stopload < 2) {
if(!tmpelems.length) {
page++;
pgbtn.href = nxtpgurl + page;
pgbtn.innerHTML = "{echo '下一页 &raquo;'}";
showready = 1;
clearInterval(waitingtimer);
}
for(var i = 0, j = tmpelems.length; i < j; i++) {
if(tmpelems[i]) {
tmpimgs = tmpelems[i].getElementsByTagName("img");
imgsloaded = 0;
for(var m = 0, n = tmpimgs.length; m < n; m++) {
tmpimgs[m].onerror = function () {
this.style.display = "none";
};
markloaded[m] = tmpimgs[m].complete ? 1 : 0;
imgsloaded += markloaded[m];
}
if(imgsloaded == tmpimgs.length) {
$("waterfall").appendChild(tmpelems[i]);
wf = waterfall({
"index": wf.index,
"totalwidth": wf.totalwidth,
"totalheight": wf.totalheight,
"columnsheight": wf.columnsheight
});
}
}
}
}
}, 40);
}
} catch(e) {}
scrolltimer = null;
}, 320);
}
};
<!--{/if}-->
});
</script>
authicon 一辈子的梦 发表于 2013-2-17 00:04:50 | 显示全部楼层
真是难得给力的帖子啊。
authicon 小亮仔 发表于 2013-2-20 08:51:28 | 显示全部楼层
无回帖,不论坛,这才是人道。
authicon 宿迁家 发表于 2013-8-27 15:14:50 | 显示全部楼层
不错啊 现在很流行瀑布流
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-3 04:23

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

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