Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidsommer/6825954 to your computer and use it in GitHub Desktop.
Save davidsommer/6825954 to your computer and use it in GitHub Desktop.
Display Facebook Fans
<?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