FeedBurner and Twitter counts as text
Today we are going to show you a simple method to showoff your FeedBurner subscriber count as well as your Twitter follower count in your sidebar, or anywhere you want really.
The code below as well as the images for it are included in the download below.
In the code you must change the inputs where indicated for it to work:
.counts {width: 100%; font: 1.2em DeliciousRoman,sans-serif;}
.fb {float: left; width: 45%; margin-right:5px; }
.twitter {float: left; width: 45%;}
.clearer {clear:both;}
</style>
<div class="counts">
<div class="fb">
<img src="http://www.URLTOIMAGE.com/images/fb.jpg" alt="fb" style="vertical-align:middle;" />
< ?php
$url = file_get_contents(‘https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=YOUR FEEDBURNER URL’);
$begin = ‘circulation="’; $end = ‘"’;
$page = $url;
$parts = explode($begin,$page);
$page = $parts[1];
$parts = explode($end,$page);
$fbcount = $parts[0];
if($fbcount == ”) { $fbcount = ’0′; }
echo ‘<a href=YOUR FEEDBURNER URL><b>’.$fbcount.’</b> Subscribers’;
?>
</div>
<div class="twitter">
<img src="http://www.URLTOIMAGE.com/images/twit.jpg" alt="fb" style="vertical-align:middle;" />
< ?php
$username = "YOUR TWITTER USERNAME"; // Your twitter username
$output = "text&"; // text or js
$url = "http://api.syberplanet.net/twitter/?u=$username&output=$output";
$followers = file_get_contents("$url");
echo ‘<a href=http://twitter.com/YOUR TWITTERUSERNAME><strong>’.$followers.’</strong> Followers’;
?>
</div>
<div class="clearer"></div>
</div>
You can customize the CSS for it to match your current design, this is what we use on FAQPAL.
Now in order to get the counts to display is to open sidebar.tpl and add the following line:
Heres what the above will result in:
Sidebar Social Stats (11.3 KiB, 127 hits)
Enjoy.
Related Search:
- FeedBurnerandTwittercountsastext







