I’ll start by saying I don’t know much about the subject, but am posting this in the hopes that someone who does can elucidate the issue. My basic dilemma is that I have a short bit of code on my single page templates that checks to see if a visitor is from Twitter, and if so, show a little message. (Not an original idea, I think I saw it on a post at Smashing Magazine). The code they used didn’t work, but with the help of BigJibby in the Habari IRC channel, I was able to get it working with Habari.
I more or less forgot about it, until a few people noticed it and asked if it was a plugin. When I replied it wasn’t, they asked if I could make it into one. So it went into a to-do list I keep of Habari related ideas. This evening I began working on it, and while troubleshooting how to actually output something to the entry single template (that’s a whole other can of worms), I discovered the code snippet wasn’t working. With the help of Michael, we discovered the problem wasn’t with the code snippet, rather it was with the URL shorteners. Twitter recently started defaulting to Bit.ly, and I recently began experimenting with Tr.im, both of which weren’t sending twitter.com as the referrer. Rather, due to their 301 redirect they return NULL. Which in a nut shell sucks.
Somehow Google Analytics is able to track referrals from Twitter, as last week when I had a huge upsurge in traffic from the popularity of the Infinite Summer Bookmarks, I’m seeing 50 visitors from Twitter the first day (of the 785, by far a record for this little weblog).
At this point, finishing the plugin seems moot, as the only way to be sure that visitors will actually see the message would be to use a URL shortener that doesn’t return NULL, of which, the only one we found that to not be the case was Owen’s Pastoid. I didn’t test Tinyurl, nor was I interested in looking for others. The disappointment had already set in. Besides that, if you are auto posting to Twitter with a plugin, you wouldn’t have the option to use a different shortener.
So kind readers/stumble-uponers, if anyone has a solution to this problem, please enlighten me. Meanwhile, I’ll work out the issue with Habari and my desire to output content on a single entry template within the content output, not above the body tag.
For anyone interested in the snippet of code I am using:
if ( parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) == 'twitter.com' ) {
echo "<h2 class='twittervisit'>Welcome, Twitter visitor! If this post is useful, don't hesitate to retweet!</h2>";
Yesterday over at
I’m horrible when it comes to reading books and novels. I think it stems from when I began cooking professionally and worked a crazy amount of hours, leaving me with very little free time. What free time I did have was either spent in a bar, or reading cookbooks and trade publications to further my knowledge base. However, it also meant I got away from reading fiction in any form. Today, my reading is solely relegated to reading online, and non-fiction for the most part.
I’ll be reading along with everyone else, as well as with my fiancée. We ordered our copies a few weeks ago, and it’s been tough to not get started, but one of the premises of Infinite Summer is 75 pages a week, with discussion along the way (the book is 1000 pages, which is how the 75 pages a week idea came about—breaking the book into digestible chunks). The site will have guest writers as well as a forum, so I really wanted to follow the guide. The reading is to start Sunday, which brings me to the whole point of this post.
Well, it’s taken me what seems like forever, but I finally determined that 








