revjim.net

December 10th, 2002:

how to add a comments feed

NOTE: This template has been updated.

I’ve added a Comments RSS Feed to revjim.net. Those of you who use RSS aggregators and wish to keep up with all of the latest revjim.net comments can subscribe to it.

I HIGHLY recommend installing similar functionality on your own MovableType installations. It isn’t that important if your site has the ability to subscribe to email notifications of each post. However, if it doesn’t, keeping up with conversations (thanks to Movable Type’s horrible comment system) is very difficult. This should make it a little bit easier.

It’s actually quite simple to do. I stole Phil Ringnalda’s template and modified it so that it doesn’t require any plugins to use and still has the same functionality. Here are the steps.

  1. Log into your MovableType install.
  2. Select “Manage Blog” underneath the blog you wish to add a Comments Feed for.
  3. Choose “TEMPLATES” in the navigation bar onthe left.
  4. Click on “Create new Index Template” at the top right hand corner.
  5. Type “Comments Feed” in the “Template Name” box.
  6. Type “comments.rdf” in the “Output File” box.
  7. Paste this under “Template Body”:
    <?xml version="1.0" encoding="iso-8859-1" ?>
    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:admin="http://webns.net/mvcb/"
        xmlns="http://purl.org/rss/1.0/">
        <channel rdf:about="<$MTBlogURL$>">
            <title><$MTBlogName encode_xml="1"$> - recent comments</title>
            <link><$MTBlogURL$></link>
            <description><$MTBlogDescription encode_xml="1"$></description>
            <dc:language>en-us</dc:language>
            <dc:date><$MTDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></dc:date>
            <admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=<$MTVersion$>" />
            <items>
                <rdf:Seq>
                    <MTComments lastn="15">
                        <rdf:li rdf:resource="<$MTCommentEntryLink$>#<$MTCommentID pad="1"$>" />
                    </MTComments>
                </rdf:Seq>
            </items>
        </channel>
        <MTComments lastn="15">
            <MTCommentEntry>
                <item rdf:about="<$MTEntryLink$>#<$MTCommentID pad="1"$>">
                    <title><$MTCommentAuthor$> comments on &quot;<$MTEntryTitle$>&quot;</title>
                    <description><$MTCommentBody encode_xml="1"$></description>
                    <link><$MTEntryLink$>#<$MTCommentID pad="1"$></link>
                    <dc:contributor><$MTCommentAuthor$></dc:contributor>
                    <dc:date><$MTCommentDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></dc:date>
                </item>
            </MTCommentEntry>
        </MTComments>
    </rdf:RDF>
  8. Click “SAVE”.
  9. Click “REBUILD”.
  10. Wait for the window to pop-up.
  11. Click “REBUILD” on that new window.
  12. Announce in your blog that you now have a comments feed.

weight watcher

Yesterday, in accordance with my new goal to lose 30 pounds before Christmas, I decided to cut back on the fat and carbohydrates for dinner. I made myself a wonderful meal of squash, zucchini, and mushroom sauteed in margarine (not butter) and a bit of garlic. It was very enjoyable, though I might want to reconsider my sodium intake as well.

In celebration of my compliance with my self-inflicted, “impossible without a cleaver and some pain killers” goal, I rewarded myself with half a block of extra-sharp cheddar cheese and crackers and half a box of cordial cherries. I wanted a glass of milk but, you know, I’m watching my weight.

PEAR: Why aren’t you using it?

I love PHP. Don’t misunderstand that. However, oftentimes I find myself so incredibly frustrated with it that I all but give up on it. It’s biggest problem is its lack of infrastructure.

PHP has spent a lot of time being the little engine that could. Because of its ease of use, forgiving memory management, superb documentation, and, HTML embedding abilities, it empowered every moron with a copy of windows notepad to be “web programmers”. This isn’t exactly a bad thing. In fact, it’s how PHP really got it’s start. Without it, PHP wouldn’t be as popular as it is today.

PHP, however, has grown up a lot since then. Grown up so much, in fact, that most “real programmers” that use PHP curse the fact that it can be embedded in HTML at all. It’s time for PHP to gain some REAL infrastructure.

Perl started out with the same sort bang that PHP did. It empowered morons to do the job of a programmer. As Perl matured so did it’s infrastructure. Today, PERL has CPAN, an easily accessible collection of modules, libraries, and extensions that allow Perl to do bigger and better things than it was originally designed to do. Because of CPANs popularity, Perl programmers eventually learned how to code in modular fashion, began writing CPAN modules for everything, and soon the infrastructure that makes Perl even more versatile than before was born.

What if I were to tell you that PHP already had that infastructure? You’d say “Sure, PHP has PEAR, but it doesn’t really do anything”. Have you seen PEAR? Probably not. And neither have most people. PEAR works great. As easy as CPAN, if not easier, and it’ll only get better with more widespread usage.

So, just for fun, do this. You need PHP (4.2.x preferred, but 4.x should work, I think) and you must have it available as a system executable (CGI). In Debian do, apt-get install php4-cgi. Once you have php installed, type this at a command prompt:

lynx -source http://go-pear.org | php

A lot of the libraries contained in here aren’t very good. For instance, there is an XML_RSS library that sucks (as least in my very biased, I-wrote-my-own-damn-RSS-parser option). The problem is that people like me (who have written better alternatives) haven’t really begun using PEAR. If I had, installed my feedParser script would be as easy as typing pear install XML_RSS_FeedParser.