MUniversity of Minnesota

January 2005 Archives

January 27, 2005

Odds and ends

I've made a couple of changes recently to UThink's installation of Movable Type that are worth a mention. First of all, we all know that spamming is a huge problem in the blogging world. You may be wondering why spammers write such ridiculous comments to your blog(s), especially considering none of your readers care about viagra, free cigarettes, or texas hold 'em. Spammers write these comments not because they want you or your readers to visit their site, that would just be an added bonus. They write these comments so their links get picked up by search engines, namely Google, and to improve the page rank for their sites. Obviously, when Google sees links in your comments it treats them as it would any normal link and alters the page rank for the site in question. If a comment spammer's site link can be found on a whole bunch of blogs it will improve that site's page rank in Google. That is, until last week.

Google and other search engines and blog software creators (including Movable Type) have come up with yet another way to combat comment spam. According to Google's own post on the topic:

From now on, when Google sees the attribute (rel="nofollow") on hyperlinks, those links won't get any credit when we rank websites in our search results. This isn't a negative vote for the site where the comment was posted; it's just a way to make sure that spammers get no benefit from abusing public areas like blog comments, trackbacks, and referrer lists.
In order to implement this, Movable Type has issued a plugin that will automatically alter any link in your comments to include the rel="nofollow" attribute. I have installed this plugin on UThink. So, in other words, you don't have to do a thing. Hopefully this will cut down on the amount of spam UThink blogs currently receive. I think we have already seen a difference.

Secondly, I've added a couple of new Templates to the template changer: "Minima Blue" (a popular Blogger template that I rewrote for MT) and "Flowery." Here are a couple of small screen shots:

Minima Blue TemplateFlowery Template

Feel free to check them out. To get to the Template Changer login to your blog and click "Templates" in the left hand menu. Then click the "Template Changer" button at the top of the screen. Remember, if you use the Template Changer it will completely rework your blog. So, if you've added any links to your Main Index it will delete these and start you from scratch. If you've added any links to your Main Index I recommend copying them before running the Template Changer so you can just paste them back into place.

And of course, if you'd like to design a template for the Template Changer please feel free to do so! I will be adding more in the near future.

Posted by snackeru at 09:31 AM | Comments (2)

January 07, 2005

How do I display RSS feeds on my blog?

A couple of entries ago I wrote about RSS feeds and how to make use of the RSS feeds on UThink. Now I'd like to turn our attention to RSS feeds outside of UThink and how to make use of them on your own blog. Many people have asked me if it is possible to display RSS feeds from other blogs outside of our system on their own blog home page(s). In the past, the answer has been no due to a limitation of how we originally set up the UThink server. Now however, thanks to the server upgrades alluded to in a previous post, it is possible to present RSS (or Atom) feeds from any blog or news service that provides them. Allow me to explain how.

When we upgraded the UThink server we cleaned up our installation of PHP and made it more functional and secure. What is PHP? In a nutshell, PHP is a programming language that can help you make your blog more dynamic. Using PHP and the "lastRSS.php" script I spoke about on December 10 you can put RSS based content onto your blog home page, or another page on your blog, that updates every time the RSS feed has new content to display. Sound cool? Let's give it a try then.

Since this is somewhat of an advanced skill, it is strongly recommended that you create a test blog to try this out on. If you are new to programming, or new to PHP, do not try this on your main blog until you are confident that you know what you are doing.

The first step you will need to perform is to change the name of your blog home page from "index.html" to "index.phtml." Why? Because by naming your "index" file with a ".phtml" extension you are telling the server that there will be some PHP on this file that the server will need to parse through. So:

  1. Log into UThink and select the blog you would like to test this out on.
  2. In the left hand menu of the administrative interface, click on Templates.
  3. Click on the "Main Index" template.
  4. In the "Output File" box, enter the text "index.phtml."
  5. Click on "Save".

What this will do is change your home page's main file into "index.phtml" rather than "index.html". Have no fear! This will not change the URL of your blog. Your URL will still be .

Now we will enter the necessary PHP. At the top of the Main Index file, on top of all the other code, enter this snippet:


// include lastRSS
include "lastRSS.php";

// Create lastRSS object
$rss = new lastRSS;

// Set cache dir and cache time limit (1200 seconds)
// This will dictate how long the program should wait before it attempts to
// retrieve the RSS feed again.
$rss->cache_dir = '.';
$rss->cache_time = 1200;


As you can see, this snippet of code makes use of the "lastRSS.php" program that will do the heavy lifting of going out and retrieving the content of the RSS feed you specify. Now, all you need to do is pick the feed you'd like to show and pick a place on your blog home page to show that feed. For the sake of this demonstration, I am going to use the "Top Stories" RSS feed from Yahoo! News. That feed can be found at Now where should we put it. I would recommend somewhere in your sidebar underneath your calendar and links for your recent entries. Of course, you can pick where ever you want. If you pick the side bar, create a section for the feed and then enter this snippet of code:

// Try to load and parse RSS file
if ($rs = $rss->get('')) {
// Show website logo (if presented)
if ($rs[image_url] != '') {
echo "<a href=\"$rs[image_link]\"><img src=\"$rs[image_url]\" alt=\"$rs[image_title]\" vspace=\"1\" border=\"0\" /></a><br />\n";
// Show clickable website title
echo "<center><a href=\"$rs[link]\">$rs[title]</a></center><br />\n";
// Show website description
echo "$rs[description]<br />\n";
// Show last published articles (title, link, description)

echo "<ul>\n";
$num = 1;
foreach($rs['items'] as $item) {
if ($num <= 10) {
echo "\t<li><a href=\"$item[link]\">".$item['title']."</a><br />".$item['description']."</li>\n";
echo "</ul>\n";
else {
echo "Error: It's not possible to reach RSS file...\n";


Note the line "($rs = $rss->get(''))." Hopefully you have figured out that this is where you can put your own RSS feeds, or other feeds you or your readers may be interested in. Once you have entered the code snippet above, click "Save" within the administration interface of MT, and then "Rebuild." When it is finished, look at your blog home page to make sure everything looks good. If you'd like to see an example of what this shold look like, check out my test blog snackeru playground and look at the sidebar to the right. If you see a blank screen after you try this out it means that you have done something wrong with the PHP code. Go back, look for your errors, and try it again. Welcome to the world of programming!

Check out the lastRSS web site for more ways to render RSS feeds through PHP. If you have any questions, feel free to leave a comment!

Posted by snackeru at 01:29 PM

January 03, 2005

Please note: Server Maintenance tomorrow!

Please note that there will be server maintenace performed on tomorrow (1/4) at 7 AM. We will be updating server software at this time. As a result, UThink will not be available for approx. 15 minutes. Please plan accordingly.

Posted by snackeru at 12:51 PM