Showing posts with label Facebook and Site. Show all posts
Showing posts with label Facebook and Site. Show all posts

Thursday, 7 October 2010

Add some xfbml content

Add some xfbml content

Now it's time to add some xfbml content. This should be inserted as raw html code wherever you want it to appear in your page. A couple of examples are shown below.

Like button

urlofwebpage">

Replace the url of webpage as appropriate

Comments

unique_id">

Note that the unique_id should be unique for each separate comment thread you want.

You can find more social plugins on the Facebook developers social plugins page

You then need to repeat for any other pages that you want to add these features to.

Adding to Wordpress Template

Adding to Wordpress Template

In Wordpress you need to make the same changes as above, but these need to go into the Wordpress templates. You can also add a small amount of wordpress php code to ensure that each blog entry has it's own comment field.

This is all done in the theme for the site, and as such will be propagated across all relevant posts / pages depending upon which you update. You may want to create your own theme and edit that rather than the original, but you can just edit the original.

From the administration dashboard go to "Appearance" and "Editor", then choose the appropriate theme.

You then need to select the appropriate template file.

header.php (Header)
The xmlns tag should be entered within this template file.

footer.php (Footer)
You should insert the JavaScript code for the bottom of the page in this file.

single.php (Single Post) and/or page.php (Page Template)
These template files are used for blog posts and wordpress pages respectively. Update either or both of these depending upon which pages you would like to add your Facebook plugin to.

To include the individual post ID (eg. for the comment unique code) then add:

For example in my single.php file I have inserted the following just before the wordpress comments section:

"> ?>

Adding the Facebook JavaScript SDK to your site

Adding the Facebook JavaScript SDK to your site

To add this functionality you will need to update your web page html code. This will depend upon how you create your web pages as to how you add this. If you are using Dreamweaver you should switch to the code view; using Wordpress see later in this post; using a template based system you will need to edit the templates through a template editor; any other system you need to look for a source code edit feature.

Now start at the top of the page and look for an entity starting and add xmlns:fb="http://www.facebook.com/2008/fbml" at the end of the entity (before the closing angle bracket >). If you don't have an xmlns tag then create one as follows:

xmlns:fb="http://www.facebook.com/2008/fbml">

Now go down to the very bottom of the page and insert the following just before the tag: You will need to change the appID to the one provided when you register your application. Note you could instead copy and paste this section of code directly from the example that Facebook provides when you register.



Adding Facebook Social Plug in

I've used the Facebook Connect social plugins to provide a comments feature to my website blogs (see: Blog comments using Facebook connect social plugins).

The reason I added this was because of the way that I create my blog. I use Wordpress as my blog engine running on my WatkissOnline web server, but then depending upon the category, some of the posts are exported to the First Aid Quiz (Health, Safety and First Aid related) website and some to the PenguinTutor.com (Linux, computer and technology related) website. This works well except for one feature, the comments are not available except on the main Wordpress site. Technically it would be possible to show the comments and even to create a proxy system to submit comments, but this would need a significant amount of time to develop properly. So I looked at what other options were available and came across Facebook Connect. This provides a number of facebook social networking features that can be integrated into other web sites.

There are a number of advantages to using Facebook such as:

  • Easy to add to your web site (only a few lines of code)
  • No additional data protection regulations (Facebook is responsible for those)
  • Encourages other Facebook users to know and engage with your web site

It is the last of these that is very appealing.

There are some downsides as well such as:

  • Lack of direct ownership of the comments
  • Does not directly build your potential customer base - although creates alternative in form of "fans"
  • It is only going to be as good as how well your users trust Facebook (which is working at alaying fears over privicy at the moment)

I believe that the potential benefits more than out way the negative aspects.

Enabling Facebook Connect XFBML

Enabling Facebook Connect XFBML

There are a couple of different ways of embedding Facebook content into a website. I've chosen to use the JavaScript SDK with XFBML which incorporates the Facebook Markup Language into the page's HTML. This sounds quite scary, but is in fact a simple way of embedding the features using only a minimal amount of code. If you are not familiar with what html code is or what it looks like then you may want to learn some html before continuing (see book review HTML, XHTML & CSS Sixth Edition, by Elzabeth Castro).

The JavaScript SDK is a chunk of JavaScript code that is downloaded to your visitor's browser and converts the XFBML tags into code that your web browser can understand.

The first step to using the JavaScript SDK is to register as an application with Facebook. We won't actually be creating an application as such, but it means that you will be allocated an Application ID which is needed to allow your site to use the SDK.

Register as a Facebook application developer here.

Enter an "application name" and you will then be provided with the following information along with an example page. It's the unique App ID we are interested in here.

App name: yoursitename
App URL: http://www.yourwebsite.com
App ID: 123123123123
App secret:123123123123

Categories

Access Media Collection Add HTML facebook on site addurl Administration Tools Adsense All Cat Anatomy Virus Android Animator Anomymity Anti Virus Applications Install BELAJAR PHOTOSHOP Blog Blufftop CA-CLIPPER INTERNAL ERROR cara cari uang dari internet cari uang dari internet cashfiesta Celebs Computer Desk Computer Hang Computer Icon Computer Management Computer Repair Computer Set Up Computer Tablet Computer Touch Screen Computer Troubleshooting Cookies Cookies Definitions Crack Create DVD Create DVD Maker Create PDF Create PDF using Smart PDF Creator D-Link D-Link Router Definitions of Virus Device Device Manager DNS Doc Protect Dongle USB Drive partitions Drive parts Driver Printer HP DVD compress DVD Drive Earn Money Easy Gif Animator Elastomer Eror Solution Error Computer ERROR Solutions Error windows explorer External Hard Drive Facebook Facebook and Site File Sharing Football Game Free Articles Free Internet GAME Game Sport Googel Google Talk Hack Password Hard Drive Hard Drive Partitioning Healty Help and Support Help Support Household Aplieance How to How to Download HP Lapotop Reviews IM Google Inside Adsense intall Intall Windows 7 Ultimates Internet Internet Browser Internet Explore Ipad Java Programe Java Script JPEG JPG GIF PNG BMP Keyboard Keygen Smadav 8.7 Laptop Laptop Computer Skin Laptop vs PC Life Style Local Area Network Maintanance and Repair Make CD iso Make DVD Make money online Make Money with blog Make Your Own Copy-Protected CD with Passive Protection Messenger and Chat Microsoft Mobile Aplications Mobile Phone Modem MotorSport MOVIE Ms Word Applications MS Word to PDF Ms Words My Computer Network Set Up Networking Office Online Shoping Operating System Partitions drive Password Wifi PC Desktop PDF EDITOR PDF Remover Photoshop Picture Portable Prevent Windows XP Print Printer Error Protect CD from Copy Protect Your Computer Reboot Application Remove Pasword Excel Restore Windows Registry Router Search Engine Index Search Engines Optimizer Security Security System Shortcut Smadav 8.7 Smart PDF Creator Social Networking Software software Protection Solving Probelm Startup Programs SuperBike System Registry System Restore Table Manager Test DVD Test DVD Drive Troubleshooting all Tutorial Tutorial Java TUTORIAL PHOTOSHOP uang gratis dari cashfiesta uang gratis dari internet Upload File to blogger Upload Files USB Install USB REMOVE USB Repair VGA Card VGA Conector VGA Informations Virtual Memory is to Low Virus Viture Windows 7 Watermark What is Cookies Wifi Wifi Pasword Finder Win Pes2011 Windows Windows Device Windows DVD Maker windows explorer cannot open Windows Mobile Wireless Wireless router Word Password Remover words documents cannot open Words error XFBML and HTML Facebook