Facebook Share button

Deveren / 2011-06-24 08:23:45   

I know, I know, another dumb Fbook question. But until we are able to educate others about facebook it is a great way to "get the word out". So I"m just wondering if anyone has successfully coded a facebook share button into their site that is able to crawl a specific page for images to include in the share.

I put the share button on my page, but it's only correctly crawling the main page for images, all others it's not able to "get" the pictures. It may be some simple setting I need to change. By the way Indexhibit is great!

Deveren / 2011-06-24 08:24:08   

www.deverenfogle.com, sorry!

ironic / 2011-06-24 08:51:43   

mine work like this

www.nicolaparoldo.it

I added in the index.php file this string of code right in the div content

  1. <!-- current page code -->
  2. <?php
  3. function curPageURL 
  4.  $pageURL  'http'
  5.  if $_SERVER"HTTPS" == "on" $pageURL .= "s"
  6.  $pageURL .= "://"
  7.  if $_SERVER"SERVER_PORT" != "80" 
  8.   $pageURL .= $_SERVER"SERVER_NAME"":"$_SERVER"SERVER_PORT"$_SERVER"REQUEST_URI"
  9.   else 
  10.   $pageURL .= $_SERVER"SERVER_NAME"$_SERVER"REQUEST_URI"
  11.  
  12.  return $pageURL
  13. ?>

So i was able to replace the "your url" part of the facebook code with like this:

  1. <fb:like href="<?php echo curPageURL ?>"

So the facebook button is no more linked always to my home page, but to the page you effective are viewing.

I don't know if this is what you need or not

ironic / 2011-06-24 10:23:41   

for a cleanest code I have moved the code I wrote in the last post in mi < head > tags, it works fine

If there is a better way to do the same I will appreciate so much every advise, 'cause I'm not very expert whit html/css/php coding (I just know how to use the google search field to find stuff to crib around :D )

toubo / 2011-11-10 16:58:40   

Hello, can you sum up the right solution? thank you

ironic / 2011-11-11 11:51:29   

you can copy and past the php code i wrote up there (3rd post of this topic) into the tags of you index.php (you find the right index.php file into the folder of the theme you're corrently using for indexhibit: ndx-studio -> site -> "your theme name" )

then replace the "your url" part of the facebook code in this way:

  1. <fb:like href="<?php echo curPageURL ?>"

It still works fine for me

Vaska A / 2011-11-11 12:05:18   

What? The templates don't parse PHP directly...but you can make a plugin to output the same thing.

Vaska A / 2011-11-11 12:07:13   

I think what you want is something like this...

  1. <fb:like href='<%baseurl%><%url%>' />
ironic / 2011-11-11 13:44:55   

much better, simpler and cleaner. As I said, I only have a very little knowledge of html, the rest is a google away. Thanks vaska!

Vaska A / 2011-11-11 14:36:34   

We'll be working on real documentation quite soon - these things will be easier. Sorry things are not as clear, as simple, as they should be at times...but it's coming. ;)

ironic / 2012-04-03 09:17:14   

for everyone is visiting my website in these days landing from this page:
I DO NOT USE the method i described in this thread anymore!!

What you now see in my website is the standard XFBML like button available at this page
https://developers.facebook.com/docs/reference/plugins/like/

This thread has been closed, thank you.