Archive for the ‘WordPress’ Category

Exposing Your FeedBurner Feed In HTML Head Element

Tuesday, Sep 23rd, 2008
Comments
9cbd375e2169d671541a18b56b8c118b Del.icio.us

Feed Era

We now live in the era of feeds, where most web applications you use can produce some kind of RSS/Atom feed. In turn, these feeds can be inputs to other web applications of varied uses, such as Google Reader or FriendFeed.

Blog Feed

The first application that comes to mind when we talk about feeds would be blogs. Taking WordPress as an example, WordPress blogs produce RSS and Atom feeds. These feeds are then usually included in the HTML Head element of the blog as follows:

<head>
  <!-- Meta Tags -->
  <link rel="alternate" type="application/rss+xml"  title="RSS 2.0"   href="<?php bloginfo('rss2_url'); ?>" />
  <link rel="alternate" type="text/xml"             title="RSS .92"   href="<?php bloginfo('rss_url'); ?>" />
  <link rel="alternate" type="application/atom+xml" title="Atom 0.3"  href="<?php bloginfo('atom_url'); ?>" />
</head>

Note the definition of the Link element and its significance:

Link elements with a rel value of “alternate” are used to describe an alternate representation of the content of the current web page, and these defined relationships and help your site attract and retain visitors.

Burning Your Blog Feed

However, we all know of a great service at FeedBurner that can provide you with amazing control over your vanilla feeds, and so, most of the blogs I know ADVERTISE a FeedBurner feed rather than (or alongside) the prepackaged feeds.

Feed Discovery

What do I mean by “ADVERTISE”? Usually, a prominent subscribe link to a FeedBurner feed can be found on blogs, but the FeedBurner feed is NOT exposed in the HTML Head element. This impedes accurate feed discovery, and readers of these blogs, if using some feed discovery application, may subscribe to one of the exposed vanilla feeds instead of the “hidden” FeedBurner feed. To the content-producer, this implies a lost of feed-viewership analytics and possibly even revenue.

Experiment 1

To illustrate, I use this Greasemonkey script: Smart Google Reader Subscribe Button by Mihai which places an unobtrusive RSS icon in the upper-right corner of the browser, allowing easy subscription to RSS feeds that are discovered on any site.

Suppose I include my FeedBurner feed in the HTML Head element, the script would be able to discover two feeds. However, when I exclude my FeedBurner feed from the HTML Head element, the script would only be able to discover one feed.

Feed Discovery via Greasemonkey Script

Experiment 2

For a more conclusive example, let’s try using FireFox to subscribe to a blog feed. Again, we first test with the FeedBurner feed included, then excluded from the HTML Head element.

Feed Discovery via FireFox

As you can see, in the first setting, the FeedBurner feed was discovered and marked to be subscribed (via Google). However, in the second setting, the vanilla RSS feed was discovered, and this is definitely not what content-producers would like to see happening.

Do Your Own Experiments

Still skeptical? Test this out in Google Reader or even the Google Ajax Feed API to see which feed is discovered from your blog. There are also other feed discovery services out there which you can use to test my hypothesis, but the result would probably be the same, and the reasoning similar: Only feeds that are linked, or exposed in the HTML Head element can be easily discovered.

Conclusion

In conclusion, we should realise the importance of facilitating feed discovery and its implications to content-indexing and traffic analytics. Remember to expose your FeedBurner feed in your WordPress blog today, like so:

<head>
  <!-- Meta Tags -->
  <link rel="alternate"  href="http://feeds.feedburner.com/winstonyw" type="application/rss+xml" title="FeedBurner RSS Feed"/>
</head>
Bookmark & Share
Subscribe to Winstonyw

Getting PHP to work with MySQL

Wednesday, Jun 4th, 2008
Comments
a609d36f6d1edd2013e59720b2fd8989 Del.icio.us

In my previous post, I described how to get PHP working with LightTPD on a Windows machine. But that’s not the end of the story, since what I really wanted was to get my local WordPress installation working, and the missing piece to the puzzle is to make sure that PHP is enabled for MySQL use.

To do that, simply edit the following in the php.ini file:

  • Load MySQL extensions from the correct directory: extension_dir = “c:\php\ext”
  • Remove the comment tag for: extension=php_mysql.dl”

A simple post that’s really supposed to be appended to the previous post, but I had some problems trying to get the get the code tag working, so I prefer not to touch that post again.

Anyway, my WordPress is in the htdocs directory right now, waiting for me to start some serious templating.

Bookmark & Share
Subscribe to Winstonyw

Installing LightTPD and PHP on Windows

Wednesday, May 28th, 2008
Comments
2384792ad1d92f77539d94685529fb86 Del.icio.us

This blog is in need of a makeover, and so I am trying to keep the procrastination habit at bay, practice some GTD and get started on creating a new template for it. First of all, I need a local development environment for PHP on Windows, since I am a Windows user. Previously, I would have installed IIS on Windows and used it as the server for PHP, but it’s always a chore trying to find my Windows CD.

Fortunately, I learnt about LightTPD recently in my work at Wego and how I can use it to replace IIS as the server for PHP. It’s easy installation and setup within minutes. Great! Let’s get started!

1. Download and Install PHP

Download PHP from PHP website. I chose the zip package and simply unzipped it into my directory of choice: Almighty C drive! So now, it’s residing at “C:\php”.

2. Download and Install LightTPD

Download a Win32 version of LightTPD from the WLMP Project; I chose the Setup Wizard (.exe) version.

Double-click on the downloaded executable to start the short installation process, during which you would specify the destination of the install. I installed mine at “C:\Program Files\LightTPD”.

3. Start and Test LightTPD

To start LightTPD, go to the LightTPD directory (i.e. “C:\Program Files\LightTPD”), find the file “TestMode.bat” and double-click on it. A console window would open and indicate that the server has been started.

To test that LightTPD is working at this moment, point your browser to http://localhost. You should see a “LightTPD Test Page”.

That was easy right? Now we just need to edit some configurations to make PHP work with LightTPD.

4. Editing LightTPD Configurations

Edit the file lighttpd-inc.conf (i.e. “C:\Program Files\LightTPD\conf\lighttpd-inc.conf”) with the following:

  • Remove the comment tag for “mod-cgi” (Line 20)
  • Add this line (assuming that PHP was installed on C drive):
    • cgi.assign = ( “.php” => “C:/php/php-cgi.exe” )

5. Editing PHP Configurations

In your PHP directory, rename the file php.ini-recommended to php.ini and edit php.ini with the following:

  • short_open_tag = On
  • display_errors = On
  • doc_root = “C:\Progra~1\LightTPD\htdocs”

6. Test PHP with LightTPD

To test that LightTPD now works with PHP, create a file with the following contents:

<?php phpinfo(); ?>

Place the file in your htdocs directory (i.e. “C:\Program Files\LightTPD\htdocs”), open up your browser and browse to the page. Walaa! You should be able to see the standard phpinfo() messages.

There you have it! A development environment for PHP on Windows in 6 simple steps. Now, to get started on the new template..

Bookmark & Share
Subscribe to Winstonyw

Upgrading WordPress 2.0.x to 2.3.3

Saturday, Mar 1st, 2008
Comments
e2d9ca36b0b009941ae1c7eddcd69cd4 Del.icio.us

Are you having problems upgrading your WordPress to version 2.3.3?

After following through the extended steps of upgrading WordPress, I encountered the following error on trying to access /wp-admin/upgrade.php:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@winstonyw.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Searching Google and the WordPress forums gave me an answer. Simply add the following two lines to the .htaccess file which should be residing in the blog’s root directory:

php_value memory_limit 32M
php_flag zend.ze1_compatibility_mode Off

Then, I was able to execute /wp-admin/upgrade.php successfully.However, for some reason, WordPress would overwrite .htaccess during the upgrade procedure, and so the two lines would be missing again. I had to add the two lines back to the .htaccess file before my blog is able to work.

Now I am back in business, after forsaking this blog for more than a year!

Bookmark & Share
Subscribe to Winstonyw
Winston{YW} Copyright © 2008
Powered By Wordpress, JQuery and A Lazy Search Monkey