新闻中心
Discuz帖子中增加分享到新浪微博、搜狐微博、网易微博、人人网内容代码及源文件下载
一篇技术精湛、语言精美的帖子,除了让大家学习与分享之外,是不是需要更好的途径分享给你身边的同事朋友呢?像现在最热门的交际平台——微博。新浪微博、搜狐微博、网易微博、腾讯微博等知名微博平台,还有人气火爆的QQ空间和人人网上都可以留下你的脚印,让更多的人分享你的精美帖子,以下附上实现之后的效果图:
下面需要讲解一下操作步骤:
首先要登陆FTP工具,找到并下载到本地../template/default/forum/viewthread_node.htm 文件,将以下代码添加进去。Discuz 2.0及以下版本添加在第254行、2.5版在338行<strong>{lang viewthread_share_to}:</strong>的下面;3.0及以上版本添加在319行 <b>{lang viewthread_share_to}: </b> 的下面,修改保存好后用,用FTP工具把该文件上传到空间../template/default/forum/目录下,原文件重命名成viewthread_node.htm_bak。
下面给大家提供一下输入代码:
<!--新浪微博代码开始-->
<a style="cursor:pointer;" href="javascript:void((function(s,d,e){try{}catch(e){}var f='http://service.weibo.com/share/share.php?',u=d.location.href,p=['url=',e(u),'&title=',e(d.title),'&appkey=3456769525'].join('');function a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=620,height=450,left=',(s.width-620)/2,',top=',(s.height-450)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})(screen,document,encodeURIComponent));" title="分享到新浪微博"><img src="http://www.jiu9.org/static/image/common/sina.png" alt="新浪微博">新浪微博</a>
<!--新浪微博代码结束-->
<!--搜狐微博代码开始-->
<a href="javascript:var u=location.href;var t=document.title;t=t.substr(0,80); var c=''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);c=c.substr(0,280);var e=encodeURIComponent;var url='http://t.sohu.com/third/post.jsp?&url='+e(u)+'&title='+e(t)+'&content=utf-8&pic='+'&appkey=NmvwbQj92TnbRcxym4jD';window.open(url,'','toolbar=0,resizable=1,scrollbars=yes,status=1,width=600,height=450');void(0)" title="分享到搜狐微博"><img src="http://www.jiu9.org/static/image/common/sohu.png" alt="搜狐微博">搜狐微博</a>
<!--搜狐微博代码结束-->
<!--网易微博代码开始-->
<a target="_self" onclick="(function(){var url = '&source=254PELAUCxw51IlO' + '&info='+ encodeURIComponent(document.title) + ' ' + encodeURIComponent(document.location.href);window.open('http://t.163.com/article/user/checkLogin.do?'+url+'&'+new Date().getTime(),'newwindow','height=330,width=550,top='+(screen.height-280)/2+',left='+(screen.width-550)/2+', toolbar=no, menubar=no, scrollbars=no,resizable=yes,location=no, status=no');})()" href="javascript:void(0);" title="分享到网易微博"><img src="http://www.jiu9.org/static/image/common/163.png" alt="网易微博">网易微博</a>
<!--网易微博代码结束-->
<!--腾讯微博代码开始-->
<a href="javascript:void(0)" onclick="postToWb();" class="tmblog" title="分享到腾讯微博"><img src="http://www.jiu9.org/static/image/common/qwb.png">腾讯微博</a>
<script type="text/javascript">
function postToWb(){
var _t = encodeURI(document.title);
var _url = encodeURI(document.location);
var _appkey = encodeURI("801416073");
var _pic = encodeURI('');
var _site = '';
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>
<!--腾讯微博代码结束-->
<!--QQ空间代码开始-->
<a href="javascript:void(0);" onclick="window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent(document.location.href));return false;" title="分享到QQ空间"><img src="http://www.jiu9.org/static/image/common/qz.png" alt="分享到QQ空间">QQ空间</a>
<!--QQ空间代码结束-->
<!--人人网代码开始-->
<a href="javascript:void((function(s,d,e){if(/renren\.com/.test(d.location))return;var f='http://share.renren.com/share/buttonshare?link=',u=d.location,l=d.title,p=[e(u),'&title=',e(l)].join('');function%20a(){if(!window.open([f,p].join(''),'xnshare',['toolbar=0,status=0,resizable=1,width=626,height=436,left=',(s.width-626)/2,',top=',(s.height-436)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();})(screen,document,encodeURIComponent));" title="分享到人人网"><img src="http://www.jiu9.org/static/image/common/ren.png" alt="人人网">人人网</a>
<!--人人网代码结束-->
如果你觉得上面这种手动添加代码的方式太麻烦:
2.0及以下简体中文GBK8版请下载:
http://zhubinggui.51phpc.com/Discuz/Discuz2.0GBK.zip
2.0及以下简体中文UTF8版请下载:
http://zhubinggui.51phpc.com/Discuz/Discuz2.0UTF8.zip
2.5简体中文GBK版请下载:
http://zhubinggui.51phpc.com/Discuz/Discuz2.5GBK.zip
2.5简体中文UTF8版请下载:
http://zhubinggui.51phpc.com/Discuz/Discuz2.5UTF8.zip
3.0及以上简体中文GBK版请下载:
http://zhubinggui.51phpc.com/Discuz/Discuz3.0GBK.zip
3.0及以上简体中文UTF8版请下载:
http://zhubinggui.51phpc.com/Discuz/Discuz3.0UTF8.zip
希望能帮助大家,无忧小编在这里祝贺大家国庆快乐!!!
注:任意打开一个帖子后如果没有出现该功能,请去DZ后台更新缓存。
本文地址:https://www.51php.com/discuz/12469.html






