Location: PHPKode > projects > Buzzword > buzzword-0.8.12/contrib/rss.php
<?php

/*
 * buzzword
 * Copyright (c) 2003 Brad Taylor, Jon Tai
 *
 * $Id: rss.php,v 1.9 2004/01/17 22:27:18 bradt Exp $
 * Really Simple Syndication output for your blog.
 *
 * This file is part of buzzword.
 *
 * buzzword is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * buzzword is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with buzzword; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

require_once '../includes/config.inc';

// modify this configuration section
$base_url = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/contrib$/', '', dirname($_SERVER['PHP_SELF'])); // TODO standardize this!
$title = "buzzword $BUZZWORD_VERSION";
$description = "buzzword $BUZZWORD_VERSION";
$language = "en-us";
$contact = "hide@address.com";

header('Content-type: text/xml');

$entries = get_blog_entries_by_date(0, time(), 5);
send_cache_headers($entries[0]->modified);

$date = date('D, d M Y H:i:s T', $entries[0]->modified);
echo '<?xml version="1.0"?>';
echo "<rss version=\"0.92\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">";
echo '<channel>';
echo "<title>$title</title>";
echo "<link>$base_url</link>";
echo "<description>$description</description>";
echo "<language>$language</language>";
echo "<pubDate>$date</pubDate>";
echo "<lastBuildDate>$date</lastBuildDate>";
echo '<docs>http://backend.userland.com/rss092</docs>';
echo "<managingEditor>$contact</managingEditor>";
echo "<webMaster>$contact</webMaster>";

foreach ($entries as $entry) {
    echo "<item rdf:about=\"{$base_url}blog/entry.php?e={$entry->entry_key}\">";
    echo '<pubDate>'.htmlspecialchars(date('D, d M Y H:i:s T', $entry->created)).'</pubDate>';
    echo '<title>'.htmlspecialchars($entry->get_display_title()).'</title>';
    echo "<link>{$base_url}blog/entry.php?e={$entry->entry_key}</link>";
    echo '<description>'.htmlspecialchars($entry->get_display_short_body()).'</description>';
    echo '</item>';
}

echo '</channel>';
echo '</rss>';

?>
Return current item: Buzzword