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!
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI 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!
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!
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/