Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[修改] Discuz x2.5帖子下方增加“分享到新浪微博”的方法教程

[复制链接]
mingyn001 发表于 2013-5-18 20:27:00 | 显示全部楼层 |阅读模式
本帖最后由 mingyn001 于 2013-5-18 20:32 编辑

Discuz X2.5官方安装包里的论坛帖子分享功能里只集成了QQ空间、腾讯微博以及腾讯朋友的功能,没有分享到新浪微博的功能,而现在用新浪微博的人不在少数,因此,我们可以通过修改Discuz X2.5代码,增加论坛帖子分享到新浪微博的功能:

1、首先找到如下文件
template/default/forum/viewthread_node.htm

2、在viewthread_node.htm中找到下面代码:
  1. <div id="p_btn" class="mtw mbm cl">
  2. <!--{if !empty($$$$_G['setting']['pluginhooks']['viewthread_share_method'])}-->
  3. <div class="tshare cl">
  4. <strong>{lang viewthread_share_to}:</strong>
复制代码
在上面代码的下面添加下面代码:
  1. <!--新浪微博代码开始-->
  2. <a style="cursor:pointer;" href="javascript:void((function(s,d,e){try{}catch(e){}var
  3. f='http://v.t.sina.com.cn/share/share.php?',u=d.location.href,p=['url=',e(u),'&title=',e
  4. (d.title),'&appkey=2359670809'].join('');function a(){if(!window.open([f,p].join(''),'mb',
  5. ['toolbar=0,status=0,resizable=1,width=620,height=450,left=',(s.width-620)/2,',top=',(s.height-450)/2].join('')))
  6. u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})
  7. (screen,document,encodeURIComponent));"> <img src="static/image/common/sina.png" alt="新浪微博">新浪微博</a>
  8. <!--新浪微博代码结束-->
复制代码
3、图片地址,可下载新浪分享的小图标,保存到如下目录:static/image/common/sina.png,或者可以自己制作一个小图标。

4、保存文件并上传,这时打开一篇帖子,就会发现下面多了一个分享到“新浪微博”的功能!
本代码修改版权归原作者,
演示地址:北都论坛 www.ibeidu.com

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
1314学习网 发表于 2013-5-18 20:46:19 | 显示全部楼层
前排看看怎么样
回复

使用道具 举报

可爱的轩轩 发表于 2013-5-19 16:17:14 | 显示全部楼层
直接弄上百度分享了
回复

使用道具 举报

zaybajlhqwb 发表于 2013-5-19 22:44:14 | 显示全部楼层
x3下没效果啊
回复

使用道具 举报

zaybajlhqwb 发表于 2013-5-20 23:21:28 | 显示全部楼层
楼主发的不行,大家用我分享的
效果演示 http://witcafe.com/forum-2-1.html
  1. <!--新浪微博代码开始-->
  2. <a style="cursor:pointer;" href="javascript:void((function(s,d,e){try{}catch(e){}var f='http://v.t.sina.com.cn/share/share.php?',u=d.location.href,p=['url=',e(u),'&title=',e(d.title),'&appkey=5786724301'].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));"> <img src="static/image/common/sina.png" alt="新浪微博">新浪微博</a>
  3. <!--新浪微博代码结束-->
复制代码
回复

使用道具 举报

北都社区 发表于 2013-5-21 23:34:32 | 显示全部楼层
请问,修改代码的文件地址是什么呢?谢谢。我的是DZ x3
回复

使用道具 举报

zaybajlhqwb 发表于 2013-6-11 22:05:15 | 显示全部楼层
北都社区 发表于 2013-5-21 23:34
请问,修改代码的文件地址是什么呢?谢谢。我的是DZ x3

首先找到如下文件
template/default/forum/viewthread_node.htm
回复

使用道具 举报

qjko 发表于 2013-8-22 11:08:23 | 显示全部楼层
zaybajlhqwb 发表于 2013-6-11 22:05
首先找到如下文件
template/default/forum/viewthread_node.htm

找到了具体修改哪个位置、??
回复

使用道具 举报

yjm2000 发表于 2013-9-1 15:13:50 | 显示全部楼层
zaybajlhqwb 发表于 2013-5-20 23:21
楼主发的不行,大家用我分享的
效果演示 http://witcafe.com/forum-2-1.html

我是DZX3,直接用你的代码,成功了,谢谢你和楼主。
回复

使用道具 举报

8540423 发表于 2013-11-26 15:51:11 | 显示全部楼层
楼主,为什么我直接放上去没有效果呢。求指导
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-5-18 18:04 , Processed in 0.104795 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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