Facebook Like button, how to create one for Gallery 2: fixes thumbnail not appearing in facebook
battledingo
Joined: 2006-08-25
Posts: 39 |
Posted: Mon, 2012-10-01 13:27 |
Create a facebook like button for gallery 2 Hi Here is how to make a facebook like button for Gallery 2 Module. I didn't do any coding just read multiple forums & got help from the legend Mr.Flori Dave. Thanks Flori Dave for your help and knowledge. 1. Add the like button: In photo.tpl which is found at /public_html/gallery/themes/(your theme name here)/templates/ (It is safer to add a folder local to the templates folder & copy photo.tpl to it. Now edit the file from the local folder) Somewhere around halfway down your photo.tpl file, find: Quote:
{else} Now pop this in below it: Quote:
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.YOUR_SITE_URL.com{g->url arg1="view=core.ShowItem" arg2="itemId=`$theme.item.id`"} &layout=standard&show_faces=true&layout=standard&width=500&show_faces=false&action=like&colorscheme=light&font=lucida+grande&height=35&appId=your_facebook_app_id" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:35px;" allowTransparency="true"></iframe> Be sure to change Quote:
www.YOUR_SITE_URL.com to whatever your site is, I didn't add my gallery url to the end and it works. My gallery directory is "gallery", don't know if this code would work if your gallery is located under another name... Also change Quote:
your_facebook_app_id. To get a facebook app id see the troubleshooting notes below. It is easy to do. You now have a like button, however there will be no thumbnail on your facebook page. 2. Add the code for the facebook page so the thumbnail appears: In theme.tpl which is found at /public_html/gallery/themes/(your theme name here)/templates/ (It is safer to add a folder local to the templates folder & copy theme.tpl to it. Now edit the file from the local folder) Place this code between the <head> and </head> tags, don't forget to change the "http://www.your_website_here" and register a facbook app id to get the app number (see below) : Quote:
<meta property="og:title" content="{ $theme.item.title }" /> 3. Now make the thumbnail image appear by adding the following code in modules/core/DownloadItem.inc Under this row: Quote:
$fileName = GalleryUtilities::getRequestVariables('fileName'); I just change the mailicous-url-checker from... Quote:
if (!empty($fileName) && $fileName != $pseudoFileName) { to... Quote:
if (!empty($fileName) && $fileName != $pseudoFileName && urldecode($fileName) != $pseudoFileName) { You now should have a working like button for gallery 2. 1. Adding the like button: http://gallery.menalto.com/node/95707 (credits to cozbaldwin) 2. Adding the meta properties: http://stackoverflow.com/questions/10689677/facebook-like-button-tag-missing-error-how-do-i-fix-it 3. Help facebook recognise the url links (credits to Tornevall): http://gallery.menalto.com/node/96164#comment-359843
If you can't see the thumbnail image on facebook delete your browser cache or try another browser when you press the like button. To create a app id number: 1.Login to Facebook 2. Go to Facebook Developers Application page https://developers.facebook.com/apps 3. From all those unsuccessful trials, choose one app that you set up for a target before 4. Within the description, you will find APP ID This debugger is your best friend: http://developers.facebook.com/tools/debug (Copy & paste your URL containing the like button into the address bar and fix any error messages by editing the theme.tpl file (found in section 2.) Learn how to code the metadata: http://ogp.me/ happy coding |
|
Posts: 1
Thanks for your time and effort and in putting this together battledingo. Been trying to put this in place for a while. I've just cracked it with your steps.
You've really helped me out!!
mckeown2
Noise Cancelling Headphones Review
Posts: 39
No worries, glad to help you out.