0

I was hoping for some insight as to how I should go about getting my Fan Page friend count to display on my Drupal driven site.

Are there any good tuts out there?

Any help would do

Thanks!

1

Mind you I have the Drupal for Facebook module installed. So this is what I did:

function facebook_count($username) {
$url = "https://graph.facebook.com/".$username;
$fbData = json_decode( file_get_contents( $url, 0, null, null ), true );
return intval($fbData['likes']);
}

I then displayed it via:

<?php echo number_format(facebook_count('Fan_Page_ID') ); ?>

Hope this helps!

| improve this answer | |
0

It's a non-drupal thing. When you login in your facebook fan page, you find instructions to style and get copy n' paste Javascript/iframe code to put a "fan box" or a "like box" in your web pages: http://developers.facebook.com/docs/reference/plugins/like-box/

| improve this answer | |
  • Well I understand that. What I am looking to display on my site is just a count of friends that I have or likes to my fan page. – TikaL13 Aug 31 '11 at 18:37
  • Sorry, misunderstood – Cheope Sep 13 '11 at 0:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.