Placed in: Home arrow Programming arrow Place your feedcount in a random sentence comprar viagra en espaƱa
comprar viagra online
comprar viagra generico barato
comprar cialis generico online
comprar cialis online seguro
Place your feedcount in a random sentence

CSS-Tricks is a great website from Chris Coyier (I've mentioned it before) that I'm sure you've heard of. Next to the high quality of articles, the design of the blog is simple, yet really good. One of the things I really like about the design, is the way Chris shows his feedcount in a sentence, that will change every time you refresh your browser.

I was wondering how he created this funny RSS show-off and wanted to recreate the technique. Using Feedburner, PHP and some CSS, I managed to achieve the goal.

Place your feedcount in a random sentence

You can download the source code in the download section and you can view what we're going to make in the demo section.

Use this technique to pimp your website, making it a bit more funny and attractive for your visitors.

First things first: You'll need an account at Feedburner to make this work. If you don't have an account, register now and make sure your RSS is now directed through Feedburner. If you have an account, proceed to the next step.


The PHP code isn't really hard to understand. Just change the $sentences array to add / change the sentences that'll be displayed. Also, change the uri= when loading the XML file from Feedburner to get your own feedcount.

Comments are added to explain what the code does.

// Prepare the array of sentences.
// Note that "[NR]" will be replaces with the feed
// subscriber count
$sentences = array (
   " has [NR] addicts.",
   "If [NR] people are reading this site every day, why don't you?",
   "Get updates from this website along with [NR] others.",
   "About [NR] others will follow everything on",
   "Join [NR] people that love the montly imagedumps!",
   "[NR] readers subscribed here. Subscribe today!"
// Randomize the array using shuffle
// Set the output sentence by getting first value of new array
$sentence = $sentences[0];
// Get feedburner count (Change URI to own feedburner name)
// Load Feedburner Awareness
$xml =   simplexml_load_file
   or die ("Unable to load XML file!");
// Load Count
$circulation = $xml->feed->entry['circulation'];
// Replace the [NR] in the sentence with feedcount & add CSS
$sentence = str_replace("[NR]",
   '<span class="count">' . $circulation . '</span>' , $sentence);
$sentence = '<p class="feedcount">' . $sentence . '</p>';


Time to add some style to the classes using CSS. I'll be using the same kind of CSS message as explained in the article on how to create a valid CSS alert message.

.feedcount {
   background: #FFFFFF url(rss.gif) center no-repeat;
   background-position: 15px 50%;
   text-align: left;
   color: #FF8F00;
   font-weight: bold;
   font-size: 16px;
   padding: 5px 20px 5px 60px;
   border-top: 2px solid #FF8F00;
   border-bottom: 2px solid #FF8F00;
.count {
   font-size: 1.8em;
   font-weight: bold;
   color: #B30000;

Demo / Download

You can download the source code in the download section and you can view a demonstration of this technique in the demo section.

That's it! Pretty simple, but it can really improve your blog when used in the correct way (Just like CSS-Tricks). If you want to show your feedcount in a image, check how to show your feedcount the way you want.

Tags:  php feedcount rss webdesign

Interested in this topic? You might enjoy another article I've written called

Did you like this article? Subscribe to my feed or email to keep updated on new articles.

Spread the word and submit to:
< Prev   Next >