Forked from krutz27/display num of facebook fans.snippets
Created
October 4, 2013 13:32
-
-
Save davidsommer/6825954 to your computer and use it in GitHub Desktop.
Display Facebook Fans
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$page_id = "YOUR PAGE-ID"; | |
$xml = @simplexml_load_file("http://api.facebook.com/restserver.php?method=facebook.fql.query&query=SELECT%20fan_count%20FROM%20page%20WHERE%20page_id=".$page_id."") or die ("a lot"); | |
$fans = $xml->page->fan_count; | |
echo $fans; | |
?> | |
//MAKE FIRST WORD BOLD | |
<script> | |
$('#links a').each(function(){ | |
var me = $(this); | |
me.html( me.text().replace(/(^\w+)/,'<strong>$1</strong>') ); | |
}); | |
</script> | |
OR | |
<script> | |
$('#links a').each(function(){ | |
var me = $(this), t = me.text().split(' '); | |
me.html( '<strong>'+t.shift()+'</strong> '+t.join(' ') ); | |
}); | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment