夺宝奇兵中文站's Archiver

IndianaJones 发表于 2019-9-4 17:55

【在用】sclub代码-图片模式 x系列 无界【新旧配合使用】

旧版代码:

1、forumdisplay模版最上边加[code]{eval $wj_image_mode = $_COOKIE["wj_image_mode"];}[/code]2、然后找到[code]<!--{if $page == 1 && !empty($announcement)}-->[/code]在上边加[code]<!--{if $wj_image_mode != 1}-->[/code]接着找[code]<!--{else}-->                                <tbody><tr><th colspan="6"><p class="nodata">{lang forum_nothreads}</p></th></tr></tbody>                        <!--{/if}--></table>[/code]修改为[code]<!--{else}-->                                <tbody><tr><th colspan="6"><p class="nodata">{lang forum_nothreads}</p></th></tr></tbody>                        <!--{/if}-->        <!--{/if}-->                </table>[/code]3、然后在
</table>

下边加[code]<!-------------图片查看模式--------------->
<style>
.tl .by {
width: 105px;
line-height: 14px;
}
.chked {
padding-left: 15px;
line-height: 16px;
background: url(https://www.kuchingshare.my/template/style/images/picmode.png) no-repeat 0 3px;
color: #1E547F;
cursor: pointer;
background-position: 0 -37px;
}
.unchk {
padding-left: 15px;
line-height: 16px;
background: url(https://www.kuchingshare.my/template/style/images/picmode.png) no-repeat 0 3px;
color: #1E547F;
cursor: pointer;
}
.waterfall {
position: relative;
margin-top: 25px;
margin-left: 22px;
}
.waterfall li {
float: left;
width: 215px;
overflow: hidden;
margin: 0 10px 10px 0;
padding: 0 0 3px;
text-align: left;
border-width: 1px 0 0;
border-top: 1px solid #EAEAEA;
background: url(https://www.kuchingshare.my/template/style/images/piclong.png) no-repeat 100% 100%;
}
.waterfall .c {
overflow: hidden;
padding-bottom: 0;
max-height: 800px;
}
.waterfall .c, .waterfall h3 {
padding: 10px;
border: solid #EAEAEA;
border-width: 0 1px;
background-color: #F8F8F8;
}
.waterfall .c, .waterfall h3 {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 10px;
border: solid #EAEAEA;
border-width: 0 1px;
background-color: #F8F8F8;
}
.waterfall .auth {
padding: 0 10px 10px;
border-width: 0 1px 1px;
border-style: solid;
border-color: transparent #EAEAEA #B9B9B9;
background: #F8F8F8;
}
</style>
<!--{if $wj_image_mode == 1}-->
<div style="position: relative;">
<form method="post" name="moderate" id="moderate" action="topicadmin.php?action=moderate&fid=$fid&infloat=yes&nopost=yes">
<input type="hidden" name="formhash" value="{FORMHASH}" />
<input type="hidden" name="listextra" value="$extra" />

<ul id="waterfall" class="ml waterfall cl">
<!--{loop $threadlist $key $thread}-->
<li id="$thread[id]">
<div class="c cl">
{eval $q2 = $db->query("SELECT * FROM cdb_attachments WHERE tid='".$thread[tid]."' AND isimage!=0 ORDER BY pid DESC");}
{eval while ($asdfgh=$db->fetch_array($q2)) $thread[imgurl]=$asdfgh[attachment];}
<!--{if $thread[imgurl]}-->
<a href="viewthread.php?tid=$thread[tid]&extra=$extra"$thread[highlight]" target="_blank"><img src="attachments/$thread[imgurl]" alt="$thread[subject]" title="$thread[subject]" width="100%" height="145" /></a>
<!--{else}-->
<a href="viewthread.php?tid=$thread[tid]&extra=$extra"$thread[highlight]" target="_blank"><img src="https://www.kuchingshare.my/template/style/images/nophototiny.png" title="$thread[subject]" width="100%" height="145" /></a>
<!--{/if}-->
</div>
<h3 class="xw0">
<!--{if $forum['ismoderator']}-->
<!--{if $thread['fid'] == $fid && $thread['digest'] >= 0}-->
<!--{if $thread['displayorder'] <= 3 || $adminid == 1}-->
<input onclick="tmodclick(this)" class="checkbox" type="checkbox" name="moderate[]" value="$thread[tid]" />
<!--{else}-->
<input class="checkbox" type="checkbox" disabled="disabled" />
<!--{/if}-->
<!--{else}-->
<input class="checkbox" type="checkbox" disabled="disabled" />
<!--{/if}-->
<!--{/if}-->
<a href="viewthread.php?tid=$thread[tid]&extra=$extra"$thread[highlight]" onclick="atarget(this)" title="$thread[subject]">$thread[subject]</a>
</h3>
<div class="auth cl">
<cite class="xg1 y" style="float: right;color:#999;">
喜欢: $thread[views] &nbsp; 回复: <a href="thread-$thread[tid]-1-1.html" title="$thread[replies] 回复">$thread[replies]</a>
</cite>
<!--{if $thread['authorid'] && $thread['author']}-->
<a href="space.php?uid=$thread[authorid]">$thread[author]</a>
<!--{else}-->
<!--{if $forum['ismoderator']}-->
<a href="space.php?uid=$thread[authorid]">匿名</a>
<!--{else}-->
{lang anonymous}
<!--{/if}-->
<!--{/if}-->
</div>
</li>
<!--{/loop}-->
</ul>
</div>
</form>
<!--{/if}-->
<!-------------图片查看模式end--------------->[/code]然后再找[code]<li><a class="order {if $orderby == 'heats' || $orderby == 'recommends'}order_active{/if}" href="forumdisplay.php?fid={$fid}&filter=$filter&orderby={if $filter == 'recommend'}recommends{else}heats{/if}$typeadd$sortadd">{lang order_heats}</a></li>
[/code]在下边加[code]<!--{if $wj_image_mode != 1}--><li style="float:right;"><a onclick="setcookie('wj_image_mode', 1, 999999);location.reload();" title="开启图片模式" class="unchk" href="javascript:;">图片模式</a></li><!--{/if}--><!--{if $wj_image_mode == 1}--><li style="float:right;"><a onclick="setcookie('wj_image_mode', 2, 999999);location.reload();" title="关闭图片模式" class="chked" href="javascript:;">图片模式</a></li><!--{/if}-->[/code]注意不同:

在上面结束后继续以下步骤:

如果设置默认图片模式的话[code]<!--{if $page == 1 && !empty($announcement)}-->
[/code]上面的那条代码改为[code]<!--{if $wj_image_mode == 1}-->
[/code]然后把[code]<!--{if $wj_image_mode == 1}-->
<div style="position: relative;">
[/code]改为[code]<!--{if $wj_image_mode != 1}-->
<div style="position: relative;">
[/code]最后把[code]<!--{if $wj_image_mode != 1}--><li style="float:right;"><a onclick="setcookie('wj_image_mode', 1, 999999);location.reload();" title="开启图片模式" class="unchk" href="javascript:;">图片模式</a></li><!--{/if}--><!--{if $wj_image_mode == 1}--><li style="float:right;"><a onclick="setcookie('wj_image_mode', 2, 999999);location.reload();" title="关闭图片模式" class="chked" href="javascript:;">图片模式</a></li><!--{/if}-->
[/code]改为[code]<!--{if $wj_image_mode == 1}-->
<li style="float:right;"><a onclick="setcookie('wj_image_mode', 2, 999999);location.reload();" title="开启图片模式" class="unchk" href="javascript:;">图片模式</a></li><!--{/if}-->
<!--{if $wj_image_mode != 1}-->
<li style="float:right;"><a onclick="setcookie('wj_image_mode', 1, 999999);location.reload();" title="关闭图片模式" class="chked" href="javascript:;">图片模式</a></li><!--{/if}-->
[/code]新版本调用新的模板如下:

修改方法:

1、新建一个模板命名为forumdisplay_image_mode
2、将自己正在使用的forumdisplay模板全部内容拷贝到新建的forumdisplay_image_mode中
3、在新建的模板forumdisplay_image_mode的最上边加代码[code]{eval $wj_image_mode = $_COOKIE["wj_image_mode"];}[/code]4、继续在新模板中找到[code]<table summary="forum_$fid" {if !$separatepos}id="forum_$fid"{/if} cellspacing="0" cellpadding="0" class="datatable">[/code]在下边加[code]<!--{if $wj_image_mode == 1}-->
<span class="xx2">
<a onclick="setcookie('wj_image_mode', 2, 999999);location.reload();" title="开启图片模式" class="unchk" href="javascript:;">图片模式</a>
</span>
<!--{/if}-->
<!--{if $wj_image_mode != 1}-->
<span class="xx2">
<a onclick="setcookie('wj_image_mode', 1, 999999);location.reload();" title="关闭图片模式" class="chked" href="javascript:;">图片模式</a>
</span>
<!--{/if}-->
[/code]5、继续找到[code]<tbody id="$thread[id]">[/code]在上边加[code]<!-------------图片查看模式--------------->
<style>
.tl .by {
width: 105px;
line-height: 14px;
}
.chked {
padding-left: 15px;
line-height: 16px;
background: url(https://www.kuchingshare.my/template/style/images/picmode.png) no-repeat 0 3px;
color: #1E547F;
cursor: pointer;
background-position: 0 -36px;
}
.unchk {
padding-left: 15px;
line-height: 16px;
background: url(https://www.kuchingshare.my/template/style/images/picmode.png) no-repeat 0 3px;
color: #1E547F;
cursor: pointer;
background-position: 0 4px;
}
.waterfall {
position: relative;
margin-top: 25px;
margin-left: 22px;
}
.waterfall li {
float: left;
width: 256px;
overflow: hidden;
margin: 0 10px 10px 0;
padding: 0 0 3px;
text-align: left;
border-width: 1px 0 0;
border-top: 1px solid #EAEAEA;
background: url(https://www.kuchingshare.my/template/style/images/piclong.png) no-repeat 100% 100%;
}
.waterfall .c {
overflow: hidden;
padding-bottom: 0;
max-height: 800px;
}
.waterfall .c, .waterfall h3 {
padding: 10px;
border: solid #EAEAEA;
border-width: 0 1px;
background-color: #F8F8F8;
}
.waterfall .c, .waterfall h3 {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 10px;
border: solid #EAEAEA;
border-width: 0 1px;
background-color: #F8F8F8;
}
.waterfall .auth {
padding: 0 10px 10px;
border-width: 0 1px 1px;
border-style: solid;
border-color: transparent #EAEAEA #B9B9B9;
background: #F8F8F8;
}
</style>
<!--{if $wj_image_mode != 1}-->
<ul id="waterfall" class="ml waterfall cl">
<li id="$thread[id]">
<div class="c cl">
{eval $q2 = $db->query("SELECT * FROM cdb_attachments WHERE tid='".$thread[tid]."' AND isimage!=0 ORDER BY pid DESC");}
{eval while ($asdfgh=$db->fetch_array($q2)) $thread[imgurl]=$asdfgh[attachment];}
<!--{if $thread[imgurl]}-->
<a href="viewthread.php?tid=$thread[tid]&extra=$extra"$thread[highlight]" target="_blank"><img src="attachments/$thread[imgurl]" alt="$thread[subject]" title="$thread[subject]" width="100%" height="145" /></a>
<!--{else}-->
<a href="viewthread.php?tid=$thread[tid]&extra=$extra"$thread[highlight]" target="_blank"><img src="https://www.kuchingshare.my/template/style/images/nophototiny.png" title="$thread[subject]" width="100%" height="145" /></a>
<!--{/if}-->
</div>
<h3 class="xw0">
<!--{if $forum['ismoderator']}-->
<!--{if $thread['fid'] == $fid && $thread['digest'] >= 0}-->
<!--{if $thread['displayorder'] <= 3 || $adminid == 1}-->
<input onclick="tmodclick(this)" class="checkbox" type="checkbox" name="moderate[]" value="$thread[tid]" />
<!--{else}-->
<input class="checkbox" type="checkbox" disabled="disabled" />
<!--{/if}-->
<!--{else}-->
<input class="checkbox" type="checkbox" disabled="disabled" />
<!--{/if}-->
<!--{/if}-->
<a href="viewthread.php?tid=$thread[tid]&extra=$extra"$thread[highlight]" onclick="atarget(this)" title="$thread[subject]">$thread[subject]</a>
</h3>
<div class="auth cl">
<cite class="xg1 y" style="float: right;color:#999;">
喜欢: $thread[views] &nbsp; 回复: <a href="thread-$thread[tid]-1-1.html" title="$thread[replies] 回复">$thread[replies]</a>
</cite>
<!--{if $thread['authorid'] && $thread['author']}-->
<a href="space.php?uid=$thread[authorid]">$thread[author]</a>
<!--{else}-->
<!--{if $forum['ismoderator']}-->
<a href="space.php?uid=$thread[authorid]">匿名</a>
<!--{else}-->
{lang anonymous}
<!--{/if}-->
<!--{/if}-->
</div>
</li>
</ul>
<!--{else}-->
<!-------------图片查看模式end--------------->[/code]6、【关键】继续找到[code]   <!--{/loop}-->
                        <!--{else}-->
                                <tbody><tr><th colspan="6"><p class="nodata">{lang forum_nothreads}</p></th></tr></tbody>[/code]在上边加[code]<!--{/if}-->[/code]7、【关键】继续找到[code]<!--{if $forumseparator == 1 && $separatepos == $key + 1}-->[/code]在下边加[code]<!--{if $wj_image_mode != 1}-->
<!--{else}-->[/code]继续找到[code]<th class="subject">{lang forum_thread}</th><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
                                        </tr>
                                </tbody>
                                <!--{/if}-->[/code]在下边加
<!--{/if}-->

至此新建的模板修改完毕。

8、然后在原有的forumdisplay模板的最上边加[code]{subtemplate forumdisplay_image_mode}[/code]PS:到这里已经是全局都加了图片模式,并且默认的是图片模式。
如果想指定某板块开启图片模式,那么获取板块id后再修改forumdisplay模板即可。
获取板块id略,

修改方法:
在forumdisplay最上边把
{subtemplate forumdisplay_image_mode}修改为[code]<!--{if $fid==21}-->
{subtemplate forumdisplay_image_mode}
<!--{else}-->[/code]然后再在最下边加[code]<!--{/if}-->[/code]fid==21就是指定的板块id

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.