在 Discuz 論壇加入推推按鈕功能,可以將文章推到 Facebook,如下圖。

推推按鈕

安裝步驟:

1.先找到相關圖檔或可以自己製作圖檔,如下圖檔可儲存起來。

funp檔名:funp.gif

google檔名:google.gif

baidu 檔名:baidu.jpg

yahoo 檔名:yahoo.jpg

HD 檔名:hd.gif

myshare 檔名:myshare.gif

Plurk 檔名:Plurk_S.gif

Twitter 檔名:Twitter_S.gif

facebook 檔名:icon_facebook.gif

2.將圖檔上傳到你的網站論壇目錄/Discuz/images/common/

3.修改/Discuz/templates/default/css_common.htm

在最下面加入一行

CODE:

.iconfix { vertical-align:middle; }

4.修改/Discuz/templates/default/viewthread_node.htm

找到下面兩行,在下面兩行加入推推按鈕功能

CODE:

<div class ="{if !$thread[special]}t_msgfontfix{else}specialmsg{/if}">

<table cellspacing="0" cellpadding="0"><tr><td id="postmessage_$post[pid]">$post[message]</td></tr></table>

 

//推推按鈕 START

<span style="float:left;">推一下吧!:<font size="0">
<a href="http://funp.com/push/submit/add.php?&via=tools" target="_blank" title="貼到funP"><img src="./images/common/funp.gif" border="0"/>
</a>

<a href="javascript:desc='';if(window.getSelection)desc=window.getSelection();if(document.getSelection)desc=document.getSelection();if(document.selection)desc=document.selection.createRange().text;void(open('http://www.google.com/bookmarks/mark?op=add&bkmk='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&annotation='+encodeURIComponent(desc)));"><img src="./images/common/google.gif" title="Google Bookmarks" alt="Google Bookmarks" border="0" width="16" height="16"> </a>


<a href="javascript:desc='';if(window.getSelection)desc=window.getSelection();if(document.getSelection)desc=document.getSelection();if(document.selection)desc=document.selection.createRange().text;void(open('http://cang.baidu.com/do/add?iu='+encodeURIComponent(location.href)+'&it='+encodeURIComponent(document.title)+'&dc='+encodeURIComponent(desc)));"><img src="./images/common/baidu.jpg" title="Baidu" alt="Baidu" border="0" width="16" height="16"> </a>

<a href="javascript:desc='';if(window.getSelection)desc=window.getSelection();if(document.getSelection)desc=document.getSelection();if(document.selection)desc=document.selection.createRange().text;void(open('http://tw.myweb2.search.yahoo.com/myresults/bookmarklet?t='+encodeURIComponent(document.title)+'&u='+encodeURIComponent(window.location.href)+'&d='+encodeURIComponent(desc)+'&ei=UTF-8'));"><img src="./images/common/yahoo.jpg" title="奇摩分享書籤" alt="奇摩分享書籤" border="0" width="16" height="16">
</a>


<a href="javascript:desc='';via='';if(document.referrer)via=document.referrer;if(typeof(_ref)!='undefined')via=_ref;if(window.getSelection)desc=window.getSelection();if(document.getSelection)desc=document.getSelection();if(document.selection)desc=document.selection.createRange().text;void(open('http://www.hemidemi.com/user_bookmark/new?title='+encodeURIComponent(document.title)+'&url='+encodeURIComponent(location.href)+'&description='+encodeURIComponent(desc)+'&via='+encodeURIComponent(via)));"><img src="./images/common/hd.gif" title="HEMiDEMi" alt="HEMiDEMi 黑米共享書籤" border="0" width="16" height="16">
</a>

<a href="javascript:(function(){d=document;w=window;t='';if(d.selection){t=d.selection.createRange().text;}else{if(d.getSelection){t=d.getSelection();}else{if(w.getSelection){t=w.getSelection()}}}void(window.open('http://myshare.url.com.tw/index.php?func=newurl&url='+encodeURIComponent(location.href)+'&desc='+escape(document.title)+'&contents='+escape(t),'newwin'))})();"><img src="./images/common/myshare.gif" title="MyShare" alt="MyShare 網路書籤" border="0" width="16" height="16">
</a>

 <a href="javascript: void(window.open('http://www.plurk.com/?qualifier=shares&status=' .concat(encodeURIComponent(location.href)) .concat(' ') .concat('&#40;') .concat(encodeURIComponent(document.title)) .concat('&#41;')));"><img src="./images/common/Plurk_S.gif" title="推到Plurk" alt="推到Plurk" border="0"/>
 </a>
 
<a href="javascript: void(window.open('http://twitter.com/home/?status='.concat(encodeURIComponent(document.title)) .concat(' ') .concat(encodeURIComponent(location.href))));"><img src="./images/common/Twitter_S.gif" title="推到Twitter" alt="推到Twitter" border="0" width="16" height="16">
</a>

 

//靜態化後的連結

<a href="http://www.facebook.com/share.php?u=http://Domain/thread-$tid-$page-1.html" target="_blank"><img src="images/common/icon_facebook.gif" alt=":::一按馬上把這個話題放上你的Facebook!!:::" border="0">
</a>

//推推按鈕 END

 

//非靜態化後的連結

<a href="http://www.facebook.com/share.php?u=http://Domain$_SERVER['REQUEST_URI']" target="_blank"><img src="images/common/icon_facebook.gif" alt=":::一按馬上把這個話題放上你的Facebook!!:::" border="0">

    全站熱搜

    mitblog 發表在 痞客邦 留言(0) 人氣()