Custom Search

Facebook

                              How To Display Facebook Fan Count In Text

Adding a Facebook Like Button on your website or blog is perhaps one of the easiest and most effective way to get more fans and earn more likes. If you have hundreds, thousand or perhaps tens of thousand of fans, it might be a good idea to publish a fan countFan count displays in numeric text total fans your Facebook page has, or rather, how many have liked your page.
The technique is simple and very similar to displaying Google feedcount in text. The only difference is – we will be using Facebook’s API. In this post, we want to show you how it can be done so you can add them into yourWordPress blog or PHP powered website. Load up your favorite code editor, here we go.

Step 1 – Get API Key, Application Secret & Page ID

These are the three mandatory information you’ll need to get things started.
API Key and Application Secret
  1. Sign in to your Facebook and click on Developer‘s link on the site bar. (If you don’t have a Developer’s account, you will have to sign up for one first)
    facebook developer link How to Display Facebook Fan Count in Text
  2. Click "Set Up New Application". Enter any application name, agree to the Facebook terms and click"Create Application". Note: We are not going to create a real application, but we’ll need to go through these processes to get a API Key and Application Secret.
    create application How to Display Facebook Fan Count in Text
  3. On the next page, you should be able to see your personal API Key and Application Secret. Copy it down somewhere or leave the browser window open.
    api key How to Display Facebook Fan Count in Text

Page ID
Page ID is the ID of your Facebook Fan Page. If you don’t have a Facebook Fan page, you’ll have to first create one. To get the ID of your Fan page, click edit page, and look for your ID (numbers) at the end of the URL – http://www.facebook.com/pages/edit/?id=XXXXXXXXX

Step 2 – Get Facebook.Php

You’ll also need the Facebook API PHP SDK file called Facebook.php. Download it, and place it in the root of your folder. Learn more about Facebook PHP SDK.
php sdk How to Display Facebook Fan Count in Text

Step 3 – Display Fancount

To show off your fancount, place the following code in your php file,
  1. <?php  
  2. require_once('facebook.php');  
  3. $facebook = new Facebook(array(  
  4.     'appId'  => 'app_id',  
  5.     'secret' => 'secret_key',  
  6.     'cookie' => true,  
  7. ));  
  8. $result = $facebook->api(array(  
  9.     'method' => 'fql.query',  
  10.     'query' => 'select fan_count from page where page_id = page_id;'  
  11. ));  
  12. $fb_fans = $result[0]['fan_count'];  
  13. ?>  
And then you will want to edit the codes to change the following:
  • Line 4 – Replace app_id with your Facebook Application ID.
  • Line 5 – Replace secret_key with Secret.
  • Line 10 – Replace the last page_id with your Facebook Fanpage ID.
Please refer to Step 1 on how to get app_idsecret_key and page_id.
To display the fancount, insert this following code anywhere in the page:
  1. <?php echo $fb_fans; ?>  
That’s all. Style your fancount and make it attractive. See a working example on Psdeluxe‘s top right corner.







                                          How to Use  Facebook 20Tips

If you surf Facebook on daily basis or occasionally, chances are you’re already familiar with regular stuffs like add/delete friends, update statuses, walls and profile, add and explore pages & applications, etc, but there’s more..
This week we want to cover some interesting things you can do on (or with) Facebook; inclusive of tricks that are not documented or unknown to many, as well as tips to stay connected better with your friends. Without further ado, here’s 20 Facebook Tips/Tricks You Might Not Know. If you have interesting tips/tricks related to Facebook, please feel free to share in the comment box below.
  1. How To Place Facebook Chat On Firefox Sidebar

    If you are using Firefox, you can place the Facebook Chat at the sidebar.
    Facebook Chat Firefox Sidebar 20 Facebook Tips/Tricks You Might Not Know
  2. How To Download Facebook Photo Albums

    FacePAD: Facebook Photo Album Downloader allows you to download your friends’ facebook albums, Events albums, and Group Albums, en masse, with the click of a button.
    facepad 20 Facebook Tips/Tricks You Might Not Know
  3. How To Share Flickr Photos To Facebook

    Flickr2Facebook is an unofficial Flickr to Facebook uploader(bookmarklet) which allows you upload photos to Facebook from Flickr.

    How To Update Facebook Without Using Facebook
  4. hellotxt and Ping.fm both introduced features that let Facebook administrators update Facebook Pages.
    hellotxt 20 Facebook Tips/Tricks You Might Not Know
  5. How To Schedule Facebook Messages

    Sendible lets you schedule Facebook messages ahead of time so you can send messages to your friends, customers or colleagues in the future.
    sendible 20 Facebook Tips/Tricks You Might Not Know
  6. How To "Friend" Someone On Facebook & Hide It From Your Status Updates

    A short tutorial on Makeuseof to guide you how to hide Facebook status updates and keep that fact confined to your closer friends.
    hide status 20 Facebook Tips/Tricks You Might Not Know
  7. How To Create A Photo Collage Using Pictures Of Your Facebook Friends

    Click on Friends tab. Proceed to More tab. From "Choose an option" dropdown, choose any of the dashes "" . Your Facebook friends collage is right on your computer screen.
    photo collage 20 Facebook Tips/Tricks You Might Not Know
  8. How To Know When Facebook Friends Secretly Delete Or Block You

    This service has been discontinued. X-Friends is a unique tool for tracking friends that disappear from Facebook.
    X friends 20 Facebook Tips/Tricks You Might Not Know
  9. How To Display Selected Pictures Only On Your Facebook Profile Page

    A little-known feature in Facebook that lets you decide who shows up in that Friends box. Click that "edit" pencil in your Friends box and type the names of your best friends in the box that says "Always show these friends"
    friend photos 20 Facebook Tips/Tricks You Might Not Know
  10. How To Remove Facebook Advertisements

    This Greasemonkey script – Facebook: Cleaner removes many of the annoying ads and updates that unavoidably appear on your Facebook pages.
    ads 20 Facebook Tips/Tricks You Might Not Know
  11. How To Syncs Photos Of Facebook Friends With Contacts In Microsoft Outlook

    OutSync is a free Windows application that syncs photos of your Facebook friends with matching contacts in Microsoft Outlook. It allows you to select which contacts are updated. So you can update all contacts at once or just a few at a time.
    outsync 20 Facebook Tips/Tricks You Might Not Know
  12. How To Display Facebook Statuses On WordPress Blog

    The following method make use of Facebook status feed and WordPress RSS widget to display Facebook Statuses on WordPress blog.. It will also work for self-host WordPress blogs.
    statuses 20 Facebook Tips/Tricks You Might Not Know
  13. How To Post Your Blog Posts To Your Facebook Wall Automatically

    Wordbook allows you to cross-post your blog posts to your Facebook Wall. Your Facebook “Boxes” tab will show your most recent blog posts.
    wordbook 20 Facebook Tips/Tricks You Might Not Know
  14. How To Access Facebook Chat On Desktop

    Gabtastik and digsby let you keep Facebook chat sessions open on your Windows desktop outside of your regular web browser, using minimal screen real estate and system memory.
    gabtastik 20 Facebook Tips/Tricks You Might Not Know
  15. How To Create Quiz On Facebook Easily

    LOLapps provides quiz creator that can be employed to conjure up these popular personality quizzes that are so widespread in Facebook.
    lolapps 20 Facebook Tips/Tricks You Might Not Know
  16. How To Hide Your Online Status On Facebook Chat From Select Contacts

    Facebook has integrated friends list with Chat and you can also choose which of these list members get to see you online.
    hide 20 Facebook Tips/Tricks You Might Not Know
  17. How To Get Facebook Updates On Email

    NutshellMail consolidates your Facebook accounts through the inbox you use the most.
    nutshellmail 20 Facebook Tips/Tricks You Might Not Know
  18. How To Update Facebook Status From Firefox

    FireStatus is a status update utility for multiple social networks, including FaceBook.
    firestatus 20 Facebook Tips/Tricks You Might Not Know
  19. How To Get Facebook On Your Desktop

    Seesmic DesktopFacebookerXobniFacebook Sidebar GadgetScrapboy and Facebook AIR application are desktop applications that allows you interact with your stream just as you would on Facebook, but without the browser.
    desktop apps 20 Facebook Tips/Tricks You Might Not Know
  20. How To Delete, Cancel And Terminate Facebook Account And Profile

    A simple guide to terminate, delete or cancel Facebook account, together with the Facebook profile easily.
    terminate 20 Facebook Tips/Tricks You Might Not Know



How To Display Facebook Fan Count In Text

Adding a Facebook Like Button on your website or blog is perhaps one of the easiest and most effective way to get more fans and earn more likes. If you have hundreds, thousand or perhaps tens of thousand of fans, it might be a good idea to publish a fan countFan count displays in numeric text total fans your Facebook page has, or rather, how many have liked your page.
The technique is simple and very similar to displaying Google feedcount in text. The only difference is – we will be using Facebook’s API. In this post, we want to show you how it can be done so you can add them into yourWordPress blog or PHP powered website. Load up your favorite code editor, here we go.

Step 1 – Get API Key, Application Secret & Page ID

These are the three mandatory information you’ll need to get things started.
API Key and Application Secret
  1. Sign in to your Facebook and click on Developer‘s link on the site bar. (If you don’t have a Developer’s account, you will have to sign up for one first)
    facebook developer link How to Display Facebook Fan Count in Text
  2. Click "Set Up New Application". Enter any application name, agree to the Facebook terms and click"Create Application". Note: We are not going to create a real application, but we’ll need to go through these processes to get a API Key and Application Secret.
    create application How to Display Facebook Fan Count in Text
  3. On the next page, you should be able to see your personal API Key and Application Secret. Copy it down somewhere or leave the browser window open.
    api key How to Display Facebook Fan Count in Text

Page ID
Page ID is the ID of your Facebook Fan Page. If you don’t have a Facebook Fan page, you’ll have to first create one. To get the ID of your Fan page, click edit page, and look for your ID (numbers) at the end of the URL – http://www.facebook.com/pages/edit/?id=XXXXXXXXX

Step 2 – Get Facebook.Php

You’ll also need the Facebook API PHP SDK file called Facebook.php. Download it, and place it in the root of your folder. Learn more about Facebook PHP SDK.
php sdk How to Display Facebook Fan Count in Text

Step 3 – Display Fancount

To show off your fancount, place the following code in your php file,
  1. <?php  
  2. require_once('facebook.php');  
  3. $facebook = new Facebook(array(  
  4.     'appId'  => 'app_id',  
  5.     'secret' => 'secret_key',  
  6.     'cookie' => true,  
  7. ));  
  8. $result = $facebook->api(array(  
  9.     'method' => 'fql.query',  
  10.     'query' => 'select fan_count from page where page_id = page_id;'  
  11. ));  
  12. $fb_fans = $result[0]['fan_count'];  
  13. ?>  
And then you will want to edit the codes to change the following:
  • Line 4 – Replace app_id with your Facebook Application ID.
  • Line 5 – Replace secret_key with Secret.
  • Line 10 – Replace the last page_id with your Facebook Fanpage ID.
Please refer to Step 1 on how to get app_idsecret_key and page_id.
To display the fancount, insert this following code anywhere in the page:
  1. <?php echo $fb_fans; ?>  
That’s all. Style your fancount and make it attractive. See a working example on Psdeluxe‘s top right corner.




No comments:

Post a Comment