Jump to content
Stef's Coding Community

Installing Facebooks Javascript SDK


Recommended Posts

I've had this headache for the last day now trying to install this damn XFBML Facebook Like Button. They key ingredient for installing this is having the Javascript SDK.. which sounds easy enough, I mean, I've installed Javascript programs before (Jquery, Script.alicous, etc..) I am by no means a master yet but I sort of know my way around building a website yet this whole process has me feeling as dumb as a drunken caveman.\

 

They say "install" the Javascript SDK.. so I download the files on Github. unzip my files to the desktop.. then I see this folder with files in it... html files, demo pages, some .js files.

 

This is where I get stuck.

 

Where does the installing come in here? do I just transfer the single folder in to the root of my site? or separate manually the .js files into the .js folder and so on?

 

Someone please either tell me how to do this.. or link to a dumb persons guide on how to do this. A lot of the tutorials I've found have been for Wordpress themes and whatnot.. but not actual pages.

 

I will be so grateful once someone helps me out here.. This whole process makes me feel like an idiot, I don't like it at all.. and here I was thinking I knew something.. :(

Link to post
Share on other sites

Do you want to setup the Like button for each page on your site? If that's the case, you'll have to customize it for each page. Easiest thing to do is print the code that the XFBML Facebook Like Button page gives you after you click on get code. You can use the iframe or the or the XFBML code. Then, in order to make it dynamic, I'd do something like this:

 

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="<?php echo('http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); ?>" layout="button_count"></fb:like>

 

That will work if you're using PHP as your language. You could also do the same thing with javascript:

 

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="javascript:document.location.href;" layout="button_count"></fb:like>

 

Hope this helps.

Edited by Kyle Undefined
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...