开启辅助访问 切换到窄版

discuz论坛使用百度分享和jiathis分享实现内容分享

[复制链接]
作者:hanhongwen 
版块:
PHP PHP-基础知识 发布时间:2018-2-23 13:53:22
2530

管理员

积分
6671
QQ
hanhongwen 发表于 2018-2-23 13:53:22 | 显示全部楼层 |阅读模式
1、找到打开模板/template/default/forum/目录下的viewthread_node_body.htm文件,查找如下内容
  1. $post[message]
复制代码


2、在代码下面添加如下代码
  1. <!-- Baidu Button BEGIN -->
  2. <div id="bdshare" class="bdshare_t bds_tools_32 get-codes-bdshare" style="padding-left:60px;">
  3. <a class="bds_tsina"></a>
  4. <a class="bds_qzone"></a>
  5. <a class="bds_tqq"></a>
  6. <a class="bds_renren"></a>
  7. <a class="bds_t163"></a>
  8. <a class="bds_tieba"></a>
  9. <a class="bds_baidu"></a>
  10. <a class="bds_kaixin001"></a>
  11. <a class="bds_hi"></a>
  12. <a class="bds_youdao"></a>
  13. <a class="bds_tqf"></a>
  14. <a class="bds_msn"></a>
  15. <a class="bds_sqq"></a>
  16. <span class="bds_more"></span>
  17. <a class="shareCount"></a>
  18. </div>
  19. <script type="text/javascript" id="bdshare_js" data="type=tools&uid=746779" ></script>
  20. <script type="text/javascript" id="bdshell_js"></script>
  21. <script type="text/javascript">
  22. document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
  23. </script>
  24. <!-- Baidu Button END -->
复制代码


3、上面是简单分享,也可加入如下代码,实现更多的分享功能
  1. <!-- Baidu Button BEGIN -->
  2. <div class="bdsharebuttonbox"><a class="bds_more" href="#" data-cmd="more"></a><a title="分享到QQ空间" class="bds_qzone" href="#" data-cmd="qzone"></a><a title="分享到新浪微博" class="bds_tsina" href="#" data-cmd="tsina"></a><a title="分享到腾讯微博" class="bds_tqq" href="#" data-cmd="tqq"></a><a title="分享到人人网" class="bds_renren" href="#" data-cmd="renren"></a><a title="分享到微信" class="bds_weixin" href="#" data-cmd="weixin"></a><a title="分享到QQ好友" class="bds_sqq" href="#" data-cmd="sqq"></a><a title="分享到腾讯朋友" class="bds_tqf" href="#" data-cmd="tqf"></a></div>
  3. <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"1","bdSize":"32"},"share":{},"image":{"viewList":["qzone","tsina","tqq","renren","weixin","sqq","tqf"],"viewText":"分享到:","viewSize":"32"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin","sqq","tqf"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
  4. <!-- Baidu Button END -->

  5. <!-- JiaThis Button BEGIN -->
  6. <div style="float:right;">
  7. <div class="jiathis_style_32x32">
  8.         <span class="jiathis_txt">关注我们:</span>
  9.         <a class="jiathis_follow_tsina" rel="http://weibo.com/safehourse"></a>
  10.        <a class="jiathis_follow_tqq" rel="http://t.qq.com/safehourse"></a>
  11.         <a class="jiathis_follow_weixin" rel="http://www.safehourse.cn/data/attachment/forum/201710/26/122026y6cbaloaybnsotsc.jpg"></a>
  12. </div>
  13. <script type="text/javascript" src="http://v3.jiathis.com/code/jia.js" charset="utf-8"></script>

  14. <div class="jiathis_style">
  15.         <a class="jiathis_like_tsina" data="width=120"></a>
  16.         <a class="jiathis_like_qzone"></a>
  17. </div>
  18. <script type="text/javascript" src="http://v3.jiathis.com/code/jia.js" charset="utf-8"></script>

  19. <script type="text/javascript" src="http://v1.ujian.cc/code/ujian.js?type=slide"></script>

  20. <script type="text/javascript" src="http://v3.jiathis.com/code/jiathis_r.js?type=left" charset="utf-8"></script>
  21. </div>
  22. <!-- JiaThis Button END -->

  23. <!-- 代码begin -->
  24. <style>
  25. *{ margin:0; padding:0; list-style:none}
  26. img{ border:0;}
  27. .safehourse_service{ width:40px; height:200px; background:url([img]http://js.safehourse.cn/images/safehourse.png[/img]) no-repeat; position:fixed; right:0px; top:200px;}
  28. .safehourse_service ul{ display:block; width:160px; height:200px; float:left; position:relative;}
  29. .safehourse_service ul .right_bar{ position:absolute;width:40px; height:200px; left:0; top:0; display:block;}
  30. .safehourse_service ul .right_qq{ position:absolute; width:120px; height:85px; right:0; top:0; display:block;}
  31. .safehourse_service ul .right_phone{ position:absolute; width:120px; height:105px; padding-top:10px;right:0; bottom:0; display:block; text-align:center; color:#555; font-size:16px; font-family:'Microsoft Yahei'; text-decoration:none;}
  32. </style>
  33. <div class="safehourse_service">
  34.   <ul>
  35.     <span class="right_bar"></span>
  36.     <a href="http://wpa.qq.com/msgrd?v=3&uin=576650356&site=qq&menu=yes" class="right_qq" target="_blank"></a>
  37.     <span class="right_phone">15561578755</span>
  38.   </ul>
  39. </div>
  40. <script src="http://js.safehourse.cn/jquery.min.js"></script>
  41. <script>
  42. jQuery(function(){
  43.         jQuery(".safehourse_service").hover(function(){
  44.                 jQuery(this).animate({width:'160px'});
  45.         },function(){
  46.                 jQuery(this).animate({width:'40px'});
  47.         });
  48. });
  49. jQuery.noConflict();
  50. </script>
  51. <!-- 代码end -->
复制代码



以上为在模板文件中添加代码实现分享功能的简单操作步骤,祝你成功
    15561578755
回复

使用道具 举报

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

本版积分规则

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