KanColle © 2014 DMM.com / KADOKAWA GAMES All Rights Reserved. / Animation by © Good Smile Company
[Discuz]首頁/主題列表 顯示站長推薦
#1
For Discuz 7.2
主題列表顯示站長推薦

主題列表 顯示 站長推薦 的方法
修改 include/cache.func.php
找到
程式碼:
'forumdisplay'    => array('smilies', 'announcements_forum', 'globalstick', 'forums', 'icons', 'onlinelist', 'advs_forumdisplay', 'forumstick'),
array裡面新增 'focus'
程式碼:
'forumdisplay'    => array('smilies', 'announcements_forum', 'globalstick', 'forums', 'icons', 'onlinelist', 'advs_forumdisplay', 'forumstick', 'focus'),

開啟 template/default/viewthread.htm
找到 focus 整段複製
程式碼:
<!--{if !empty($_DCACHE['focus']['data']) && CURSCRIPT == 'viewthread' && empty($_COOKIE['discuz_nofocus'])}-->{eval $focus = $_DCACHE['focus'];$focustid = array_rand($focus['data']);}
    <div class="focus" id="focus">
        <h3 class="float_ctrl">
            <em>{if $focus[title]}{$focus[title]}{else}{lang hottopics}{/if}</em>
            <span><a href="javascript:;" onclick="setcookie('discuz_nofocus', 1, 3600);$('focus').style.display='none'" class="close deloption" title="{lang close}">{lang close}</a></span>
        </h3>
        <hr class="shadowline" />
        <div class="detail">
            <h4><a href="{$focus[data][$focustid][url]}" target="_blank">$focus[data][$focustid][subject]</a></h4>
            <p>
                {if $focus[data][$focustid][image]}
                <a href="{$focus[data][$focustid][url]}" target="_blank">
                <img src="{$focus[data][$focustid][image]}" width="58" height="58" /></a>
                {/if}
                $focus[data][$focustid][summary]
            </p>
        </div>
        <hr class="shadowline" />
        <a href="{$focus[data][$focustid][url]}" class="moreinfo" target="_blank">{lang show}</a>
    </div>
<!--{/if}-->

修改 template/default/forumdisplay.htm
{subtemplate footer}上面一行貼上,並將判斷句裡面的viewthread改成forumdisplay
程式碼:
<!--{if !empty($_DCACHE['focus']['data']) && CURSCRIPT == 'forumdisplay'
修改 template/default/css_script.htm
找到 focus 整段複製
程式碼:
.focus { float: right; position: fixed; bottom: 0; z-index: 300; right: 0; overflow: hidden; padding: 8px; width: 255px; border: 2px solid {FLOATMASKBGCOLOR}; background: {FLOATBGCOLOR}; }
    * html .focus { position: absolute; top: expression(offsetParent.scrollTop+document.documentElement.clientHeight-this.offsetHeight); }
    .focus .float_ctrl { margin: 0; }
        .focus .float_ctrl em { font-size: 12px; }
    .focus .shadowline { margin: 8px 0 5px; *margin: 0; }
    .detail { text-align: left; }
        .detail h4 { overflow: hidden; white-space: nowrap; margin-bottom: 5px; }
        .detail p { overflow: hidden; height: 58px; }
        .detail img { float: left; margin-right: 8px; width: 58px; height: 58px; }
        .detail a { color: {TABLETEXT}; }
    .moreinfo { float: right; padding: 0 5px 0 15px; background: url({IMGDIR}/notice.gif) no-repeat 0 3px; }
找到 [CURSCRIPT = forumdisplay]
任意位置貼上

主題列表 顯示 站長推薦 的方法
照上面步驟 cache.func.php 在 index 新增 focus
判斷句在 discuz.htm 貼上並改成 index
css就直接放在[CURSCRIPT = index,forumdisplay]

不過似乎寫成Plugin,做成可以選擇在哪些頁面顯示比較方便
而且Plugin還可以判斷是不是訪客,變成首頁提示註冊
回覆


前往:


正在瀏覽這個主題的使用者: 2 位訪客