|
仿官方最新帖子底部评分、分享按钮样式,加入了朋友社区、QQ空间、腾讯、新浪微博等按钮,并且上面的评分和顶踩居中显示,上图:
修改方式:
第一步:
打开根目录/template/default/forum/viewthread_node.htm文件
找到:- <div class="uo{if $_G['group']['allowrecommend'] && $_G['setting']['recommendthread'][status]} nrate{/if}">
复制代码 替换为:第二步:
找到:- <!--{if $_G['group']['raterange'] && $post['authorid']}-->
- <a id="k_rate" href="javascript:;" onclick="showWindow('rate', 'forum.php?mod=misc&action=rate&tid=$_G[tid]&pid=$post[pid]', 'get', -1);return false;" title="{echo count($postlist[$post[pid]][totalrate]);} {lang people_score}">{lang rate} </a>
- <!--{/if}-->
- <a href="home.php?mod=spacecp&ac=favorite&type=thread&id=$_G[tid]" id="k_favorite" onclick="showWindow(this.id, this.href, 'get', 0);" onmouseover="this.title = $('favoritenumber').innerHTML + ' {lang activity_member_unit}{lang thread_favorite}'">{lang thread_favorite}<span id="favoritenumber">{$_G['forum_thread']['favtimes']}</span></a>
- <a href="home.php?mod=spacecp&ac=share&type=thread&id=$_G[tid]" id="k_share" onclick="showWindow(this.id, this.href, 'get', 0);" onmouseover="this.title = $('sharenumber').innerHTML + ' {lang activity_member_unit}{lang thread_share}'">{lang thread_share}<span id="sharenumber">{$_G['forum_thread']['sharetimes']}</span></a>
- <!--{if $_G['perm']['allowrecommend'] && $_G['setting']['recommendthread']['status']}-->
- <a id="recommend_add" href="forum.php?mod=misc&action=recommend&do=add&tid=$_G[tid]" {if $_G['uid']}onclick="ajaxmenu(this, 3000, 1, 0, '43', 'recommendupdate({$_G['group']['allowrecommend']})');return false;"{else} onclick="showWindow('login', this.href)"{/if} onmouseover="this.title = $('recommendv_add').innerHTML + ' {lang activity_member_unit}$_G[setting][recommendthread][addtext]'">$_G['setting']['recommendthread'][addtext]<span id="recommendv_add">$_G[forum_thread][recommend_add]</span></a>
- <a id="recommend_subtract" href="forum.php?mod=misc&action=recommend&do=subtract&tid=$_G[tid]" {if $_G['uid']}onclick="ajaxmenu(this, 3000, 1, 0, '43', 'recommendupdate(-{$_G['group']['allowrecommend']})');return false;"{else} onclick="showWindow('login', this.href)"{/if} onmouseover="this.title = $('recommendv_subtract').innerHTML + ' {lang activity_member_unit}$_G[setting][recommendthread][subtracttext]'">$_G['setting']['recommendthread'][subtracttext]<span id="recommendv_subtract">$_G[forum_thread][recommend_sub]</span></a>
- <!--{/if}-->
复制代码 替换为:- <style type="text/css">
- .qc_rate { width: 100%; text-align: center; }
- .qc_rate table { margin: 0 auto; width: auto; }
- .qc_rate td { background: url({IMGDIR}/rate_btn.png) no-repeat 0 0; text-align: left; }
- .td_rate { padding-right: 10px; width: 86px; }
- .td_rate a { padding-left: 32px; }
- .td_recommend_add { width: 70px; background-position: 0 -42px !important; }
- .td_recommend_add a { padding-left: 32px; }
- .td_recommend_subtract { width: 70px; background-position: 0 -84px !important; text-align: right !important; }
- .td_recommend_subtract a { padding-right: 32px; }
- .qc_rate a { display: block; line-height: 39px; color: {HIGHLIGHTLINK}; }
- #k_rate, #recommend_add, #recommend_subtract { background: none; }
- .qc_rate i { float: left; width: 0; height: 0; overflow: hidden; }
- .qc_share { }
- .qc_share a { float: left; margin-right: 6px; padding-left: 21px; }
- #k_favorite, #k_share, #k_qqshare, #k_weibo { background: url({IMGDIR}/share_btn.png) no-repeat 0 -24px; }
- #k_pengyou { background: url({IMGDIR}/share_pengyou.png) no-repeat}
- #k_sinaweibo { background: url({IMGDIR}/share_sinaweibo.png) no-repeat}
- #k_favorite { background-position: 0 -48px; }
- #k_share { background-position: 0 -72px; }
- #k_weibo { background-position: 0 0; }
- #k_pengyou { background-position: 0 0; }
- #k_sinaweibo { background-position: 0 0; }
- .qc_share i { float: left; padding: 0 5px; height: 24px; background: url({IMGDIR}/share_btn.png) no-repeat 100% 100%; line-height: 24px; font-style: normal; cursor: pointer; }
- .qc_share span { padding-left: 3px; color: {LIGHTTEXT}; }
- </style>
- <div class="qc_rate mtw">
- <table cellspacing="0" cellpadding="0">
- <tr>
- <!--{if $_G['group']['raterange'] && $post['authorid']}-->
- <td class="td_rate">
- <a id="k_rate" href="javascript:;" onclick="showWindow('rate', 'forum.php?mod=misc&action=rate&tid=$_G[tid]&pid=$post[pid]', 'get', -1);return false;" title="{echo count($postlist[$post[pid]][totalrate]);} {lang people_score}">{lang rate}</a>
- </td>
- <!--{/if}-->
- <!--{if ($_G['group']['allowrecommend'] || !$_G['uid']) && $_G['setting']['recommendthread']['status']}-->
- <td class="td_recommend_add">
- <a id="recommend_add" href="forum.php?mod=misc&action=recommend&do=add&tid=$_G[tid]" {if $_G['uid']}onclick="ajaxmenu(this, 3000, 1, 0, '43', 'recommendupdate({$_G['group']['allowrecommend']})');return false;"{else} onclick="showWindow('login', this.href)"{/if} onmouseover="this.title = $('recommendv_add').innerHTML + ' {lang activity_member_unit}$_G[setting][recommendthread][addtext]'"><i>$_G['setting']['recommendthread'][addtext]</i><span id="recommendv_add">$_G[forum_thread][recommend_add]</span></a>
- </td>
- <td class="td_recommend_subtract">
- <a id="recommend_subtract" href="forum.php?mod=misc&action=recommend&do=subtract&tid=$_G[tid]" {if $_G['uid']}onclick="ajaxmenu(this, 3000, 1, 0, '43', 'recommendupdate(-{$_G['group']['allowrecommend']})');return false;"{else} onclick="showWindow('login', this.href)"{/if} onmouseover="this.title = $('recommendv_subtract').innerHTML + ' {lang activity_member_unit}$_G[setting][recommendthread][subtracttext]'"><i>$_G['setting']['recommendthread'][subtracttext]</i><span id="recommendv_subtract">$_G[forum_thread][recommend_sub]</span></a>
- </td>
- <!--{/if}-->
- </tr>
- </table>
- </div>
- <div class="qc_share mtw mbm cl">
- <a href="home.php?mod=spacecp&ac=favorite&type=thread&id=$_G[tid]" id="k_favorite" onclick="showWindow(this.id, this.href, 'get', 0);" onmouseover="this.title = $('favoritenumber').innerHTML + ' {lang activity_member_unit}{lang thread_favorite}'"><i>{lang thread_favorite}<span id="favoritenumber">{$_G['forum_thread']['favtimes']}</span></i></a>
- <a href="home.php?mod=spacecp&ac=share&type=thread&id=$_G[tid]" id="k_share" onclick="showWindow(this.id, this.href, 'get', 0);" onmouseover="this.title = $('sharenumber').innerHTML + ' {lang activity_member_unit}{lang thread_share}'"><i>{lang thread_share}<span id="sharenumber">{$_G['forum_thread']['sharetimes']}</span></i></a>
- <a href="javascript:void(0);" id="k_qqshare" onclick="window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent(document.location.href));return false;" target="_blank" title="分享到QQ空间"><i>分享到QQ空间</i></a>
- <a href="javascript:void(0);" id="k_pengyou" onclick="window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?to=pengyou&url='+encodeURIComponent(document.location.href));return false;" target="_blank" title="分享到朋友社区"><i>分享到朋友社区</i></a>
- <a id="k_weibo" href="javascript:void(0)" onclick="postToWb();" title="转播到腾讯微博"><i>转播到腾讯微博</i></a>
- <script type="text/javascript">
- function postToWb(){
- var _t = encodeURI('{$_G['forum_thread']['subject']}【狐朋狗友网推荐】');
- var _url = encodeURIComponent(document.location);
- var _appkey = encodeURI("0deb5dd8e4034ee182a147d0c5d53c52");//你从腾讯获得的appkey
- var _pic = encodeURI('');//(例如:var _pic='图片url1|图片url2|图片url3....)
- var _site = 'htttp://www.foxanddogs.com';//你的网站地址
- var _u = 'http://v.t.qq.com/share/share.php?title='+_t+'&url='+_url+'&appkey='+_appkey+'&site='+_site+'&pic='+_pic;
- window.open( _u,'转播到腾讯微博', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
- }
- </script>
- <a id="k_sinaweibo" href="javascript:void(0)" onclick="postToSinaWb();" title="转播到新浪微博"><i>转播到新浪微博</i></a>
- <script type="text/javascript">
- function postToSinaWb(){
- var _t = encodeURI('{$_G['forum_thread']['subject']}【狐朋狗友网推荐】');
- var _url = encodeURIComponent(document.location);
- var _appkey = encodeURI("746253572");//你从新浪获得的appkey
- var _u = 'http://service.t.sina.com.cn/share/share.php?url='+_url+'&title='+_t+'&appkey='+_appkey;
- window.open( _u,'转播到新浪微博', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
- }
- </script>
- </div>
复制代码 第三步:
并且记得,最后那段代码中,部分API和网址、网站名需要换成你自己的,比如:- var _t = encodeURI('{$_G['forum_thread']['subject']}【狐朋狗友网推荐】');
- var _url = encodeURIComponent(document.location);
- var _appkey = encodeURI("0deb5dd8e4034ee182a147d0c5d53c52");//你从腾讯获得的appkey
- var _pic = encodeURI('');//(例如:var _pic='图片url1|图片url2|图片url3....)
- var _site = 'htttp://www.foxanddogs.com';//你的网站地址
复制代码 中的
【狐朋狗友网推荐】
0deb5dd8e4034ee182a147d0c5d53c52
htttp://www.foxanddogs.com
应该换成你自己的网站名、腾讯微博API、网址,
同理,下面的新浪微博代码也是:- var _t = encodeURI('{$_G['forum_thread']['subject']}【狐朋狗友网推荐】');
- var _url = encodeURIComponent(document.location);
- var _appkey = encodeURI("746253572");//你从新浪获得的appkey
复制代码 其中的:
换成你自己的网站名和新浪微博应用API
第四步:
1、上传viewthread_node.htm到对应位置(提醒备份原文件,以免造成损失)。
2、上传附件包中的图片到根目录/static/image/common/中,无覆盖操作,放心。
第五步:
完成,后台更新缓存
免费下载地址
图片附件:回复可下载
|
|