Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-08-29 09:50:37

beechy
Member
Registered: 2006-03-02
Posts: 92

submit to facebook

whilst browsing the bbc website I noticed some social networking tags at the bottom of each article on the following page.

http://news.bbc.co.uk/sport1/hi/football/teams/w/west_ham_utd/6967762.stm

I wanted to know how to add the submit to facebook tag on my site.

If found this page which offer the code on facebook

http://www.facebook.com/share_partners.php

At the top of the page it says

‘Add a link or button to your site to make it easier for your content to be shared on Facebook. Copy and paste the following code blocks into your site and replace ‘<url>’ with the link you want to Share.’

<script> function fbs_click() {u=location.href;t=document.title;window.open(‘http://www.facebook.com/sharer.php?u=‘encodeURIComponent(u)’&t=’+encodeURIComponent(t),‘sharer’,‘toolbar=0,status=0,width=626,height=436’);return false;}</script><style> html .fb_share_link { padding:2px 0 0 20px; height:16px; background:url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?12:26981) no-repeat top left; }</style><a href=“http://www.facebook.com/share.php?u=<url>” onclick=“return fbs_click()” target=”_blank” class=“fb_share_link”>Share on Facebook</a>

How using textpattern would I add this to my page template and make sure that the url was dynamic and always showed the correct url for the page it was on?

Offline

#2 2007-08-29 14:12:03

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: submit to facebook

Simple:

<script>function fbs_click(){u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script>
<a href="http://www.facebook.com/share.php?u=http://www.yourdomain.com<txp:page_url />" onclick="return fbs_click()" target="_blank">Share on Facebook</a>

Replace http://www.yourdomain.com with your site’s address, like http://www.textpattern.com

Cheers!

Offline

#3 2007-08-29 14:13:35

beechy
Member
Registered: 2006-03-02
Posts: 92

Re: submit to facebook

nice one thanks for that

Offline

Board footer

Powered by FluxBB