找回密码
 注册加入

扫一扫,极速登录

QQ登录

只需一步,快速开始

搜索
查看: 94675|回复: 131

仿官方最新底部评分、分享按钮(加入朋友社区、QQ空间、腾讯、新浪微博)

 火... [复制链接]
TA的专栏
发表于 2010-11-20 12:18:07 | 显示全部楼层 |阅读模式
仿官方最新帖子底部评分、分享按钮样式,加入了朋友社区、QQ空间、腾讯、新浪微博等按钮,并且上面的评分和顶踩居中显示,上图:


QQ截图未命名10.jpg


修改方式:

第一步:
打开根目录/template/default/forum/viewthread_node.htm文件

找到:
  1. <div class="uo{if $_G['group']['allowrecommend'] && $_G['setting']['recommendthread'][status]} nrate{/if}">
复制代码
替换为:
  1. <div class="nrate_temp">
复制代码
第二步:

找到:
  1. <!--{if $_G['group']['raterange'] && $post['authorid']}-->
  2. <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>
  3. <!--{/if}-->
  4. <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>
  5. <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>
  6. <!--{if $_G['perm']['allowrecommend'] && $_G['setting']['recommendthread']['status']}-->
  7. <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>
  8. <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>
  9. <!--{/if}-->
复制代码
替换为:
  1. <style type="text/css">
  2. .qc_rate { width: 100%; text-align: center; }
  3. .qc_rate table { margin: 0 auto; width: auto; }
  4. .qc_rate td { background: url({IMGDIR}/rate_btn.png) no-repeat 0 0; text-align: left; }
  5. .td_rate { padding-right: 10px; width: 86px; }
  6. .td_rate a { padding-left: 32px; }
  7. .td_recommend_add { width: 70px; background-position: 0 -42px !important; }
  8. .td_recommend_add a { padding-left: 32px; }
  9. .td_recommend_subtract { width: 70px; background-position: 0 -84px !important; text-align: right !important; }
  10. .td_recommend_subtract a { padding-right: 32px; }
  11. .qc_rate a { display: block; line-height: 39px; color: {HIGHLIGHTLINK}; }
  12. #k_rate, #recommend_add, #recommend_subtract { background: none; }
  13. .qc_rate i { float: left; width: 0; height: 0; overflow: hidden; }
  14. .qc_share { }
  15. .qc_share a { float: left; margin-right: 6px; padding-left: 21px; }
  16. #k_favorite, #k_share, #k_qqshare, #k_weibo { background: url({IMGDIR}/share_btn.png) no-repeat 0 -24px; }
  17. #k_pengyou { background: url({IMGDIR}/share_pengyou.png) no-repeat}
  18. #k_sinaweibo { background: url({IMGDIR}/share_sinaweibo.png) no-repeat}
  19. #k_favorite { background-position: 0 -48px; }
  20. #k_share { background-position: 0 -72px; }
  21. #k_weibo { background-position: 0 0; }
  22. #k_pengyou { background-position: 0 0; }
  23. #k_sinaweibo { background-position: 0 0; }
  24. .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; }
  25. .qc_share span { padding-left: 3px; color: {LIGHTTEXT}; }
  26. </style>
  27. <div class="qc_rate mtw">
  28. <table cellspacing="0" cellpadding="0">
  29. <tr>
  30. <!--{if $_G['group']['raterange'] && $post['authorid']}-->
  31. <td class="td_rate">
  32. <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>
  33. </td>
  34. <!--{/if}-->
  35. <!--{if ($_G['group']['allowrecommend'] || !$_G['uid']) && $_G['setting']['recommendthread']['status']}-->
  36. <td class="td_recommend_add">
  37. <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>
  38. </td>
  39. <td class="td_recommend_subtract">
  40. <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>
  41. </td>
  42. <!--{/if}-->
  43. </tr>
  44. </table>
  45. </div>
  46. <div class="qc_share mtw mbm cl">
  47. <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>
  48. <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>
  49. <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>
  50. <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>
  51. <a id="k_weibo" href="javascript:void(0)" onclick="postToWb();" title="转播到腾讯微博"><i>转播到腾讯微博</i></a>
  52. <script type="text/javascript">
  53. function postToWb(){
  54. var _t = encodeURI('{$_G['forum_thread']['subject']}【狐朋狗友网推荐】');
  55. var _url = encodeURIComponent(document.location);
  56. var _appkey = encodeURI("0deb5dd8e4034ee182a147d0c5d53c52");//你从腾讯获得的appkey
  57. var _pic = encodeURI('');//(例如:var _pic='图片url1|图片url2|图片url3....)
  58. var _site = 'htttp://www.foxanddogs.com';//你的网站地址
  59. var _u = 'http://v.t.qq.com/share/share.php?title='+_t+'&url='+_url+'&appkey='+_appkey+'&site='+_site+'&pic='+_pic;
  60. window.open( _u,'转播到腾讯微博', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
  61. }
  62. </script>
  63. <a id="k_sinaweibo" href="javascript:void(0)" onclick="postToSinaWb();" title="转播到新浪微博"><i>转播到新浪微博</i></a>
  64. <script type="text/javascript">
  65. function postToSinaWb(){
  66. var _t = encodeURI('{$_G['forum_thread']['subject']}【狐朋狗友网推荐】');
  67. var _url = encodeURIComponent(document.location);
  68. var _appkey = encodeURI("746253572");//你从新浪获得的appkey
  69. var _u = 'http://service.t.sina.com.cn/share/share.php?url='+_url+'&title='+_t+'&appkey='+_appkey;
  70. window.open( _u,'转播到新浪微博', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
  71. }
  72. </script>
  73. </div>
复制代码
第三步:

并且记得,最后那段代码中,部分API和网址、网站名需要换成你自己的,比如:
  1. var _t = encodeURI('{$_G['forum_thread']['subject']}【狐朋狗友网推荐】');
  2. var _url = encodeURIComponent(document.location);
  3. var _appkey = encodeURI("0deb5dd8e4034ee182a147d0c5d53c52");//你从腾讯获得的appkey
  4. var _pic = encodeURI('');//(例如:var _pic='图片url1|图片url2|图片url3....)
  5. var _site = 'htttp://www.foxanddogs.com';//你的网站地址
复制代码
中的
【狐朋狗友网推荐】
0deb5dd8e4034ee182a147d0c5d53c52
htttp://www.foxanddogs.com

应该换成你自己的网站名、腾讯微博API、网址,

同理,下面的新浪微博代码也是:
  1. var _t = encodeURI('{$_G['forum_thread']['subject']}【狐朋狗友网推荐】');
  2. var _url = encodeURIComponent(document.location);
  3. var _appkey = encodeURI("746253572");//你从新浪获得的appkey
复制代码
其中的:
【狐朋狗友网推荐】
746253572

换成你自己的网站名和新浪微博应用API

第四步:

1、上传viewthread_node.htm到对应位置(提醒备份原文件,以免造成损失)。
2、上传附件包中的图片到根目录/static/image/common/中,无覆盖操作,放心。

第五步:

完成,后台更新缓存


免费下载地址


图片附件:回复可下载
游客,如果您要查看本帖隐藏内容请回复





TA的专栏
发表于 2013-4-22 20:20:20 | 显示全部楼层
终于可以解决错位问题了。只是觉得最下面那排还是应该居中好些。
回复 支持 反对

使用道具 举报

TA的专栏
发表于 2023-1-14 13:20:59 | 显示全部楼层
一直在找方法,感谢分享
回复 支持 反对

使用道具 举报

TA的专栏
发表于 2010-11-20 12:55:06 | 显示全部楼层
回复可下载
回复 支持 反对

使用道具 举报

TA的专栏
发表于 2010-11-20 13:09:40 | 显示全部楼层
终于可以解决错位问题了。只是觉得最下面那排还是应该居中好些。
回复 支持 反对

使用道具 举报

TA的专栏
发表于 2010-11-20 13:45:42 | 显示全部楼层
真JB费事   半天才可以下载 郁闷
回复 支持 反对

使用道具 举报

TA的专栏
发表于 2010-11-20 14:09:49 | 显示全部楼层
我来了
回复 支持 反对

使用道具 举报

TA的专栏
发表于 2010-11-20 14:23:03 | 显示全部楼层
WH)3@0J@]4SZT24E5OJMVWS.jpg 我的错位,帮看看了,QQ369666924
回复 支持 反对

使用道具 举报

TA的专栏
 楼主| 发表于 2010-11-20 14:31:38 | 显示全部楼层

CSS错误,有没有更新缓存?样式不对,肯定有CSS冲突
回复 支持 反对

使用道具 举报

TA的专栏
发表于 2010-11-20 14:33:54 | 显示全部楼层
回复也要下地楼主辛苦了,谢谢楼主分享!
我觉得注册Discuz!扩展中心是注册对了!
回复 支持 反对

使用道具 举报

TA的专栏
发表于 2010-11-20 14:56:04 | 显示全部楼层
1111111111111111111111111111
回复 支持 反对

使用道具 举报

TA的专栏
发表于 2010-11-20 15:32:20 | 显示全部楼层
晕 那个朋友社区是不是QQ校友?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册加入  

本版积分规则

Archiver|手机版|小黑屋|Discuz!扩展中心 ( 浙ICP备14042422号-1 )|网站地图QQ机器人

GMT+8, 2024-3-29 20:13 , Processed in 0.401620 second(s), 16 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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