savannah-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RSS for savane news (was Re: [Savannah-hackers] status of Savannah and a


From: Nic Ferrier
Subject: RSS for savane news (was Re: [Savannah-hackers] status of Savannah and an offer)
Date: Wed, 01 Dec 2004 10:44:11 +0000

I have written some code to produce RSS for savane project news
items. 

I haven't tested the PHP yet.

It isn't easy to test this code without setting up an entire savane
system (groups, users, db, etc...).

I wonder if there is a test frame or scratch savane anywhere that I
could use? The only change I've made is an added file so it should be
very easy to hack into an existing test system.

I've attached the new file, but remember this isn't tested.


I'm a savannah hacker already so I can get to the box if we have a
test rig there.

Anyone help?


-- 
Nic Ferrier
http://www.tapsellferrier.co.uk

<?php

# RSS production for savane
# (C) Tapsell-Ferrier 2004 - Nic Ferrier <address@hidden>
#
# This program 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.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

require "../include/pre.php";

# Set up various strings
 
$group_id = $_GET['group_id'];

$channel_header = "<?xml version='1.0'?>"
      . "<rss version='2.0'>"
      . "<channel>"
      . "<items>";

$channel_footer = "</items>"
      . "</channel>"
      . "</rss>";

$sql = "SELECT id, submitted_by, date, summary, details"
      . "FROM news_bytes "
      . "WHERE is_approved = 1 "
      . "ORDER BY date";

$item_results = db_query();

# Set the content type correctly
header("Content-type: application/xml+rss");

# Send the page with the items
print $channel_header;

while ($item_row = db_fetch_array($item_results))
{
    print "<item>";
    print "<date>", $item_row['date'], "</date>";
    print "<title>", $item_row['summary'], "</title>";
    print "<description>", $item_row, "</description>";
    print 
"<link>http://savannah.gnu.org/projects/news/?group_id=$group_id</link>";
    print "</item>";
}

print $channel_footer;
?>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]