This script worked for me, but didn't really seem "right"... so... i've modified it in the following ways:
- new rss channel for each album
- changed channel name to be album name rather than gallery name
- changed channel description to be album description rather than gallery description
- changed author of each image to be the username of the contributor
- changed image title to be the image title rather than album title
- changed image description to be image description rather than album description
- fixed image descriptions... they just seemed to be a mess
- moved the image keywords to their own element
<?php
//
// Coppermine RSS 2.0 Generator (1.0)
// displays latest photo via RSS 2.0 feed.
// Compatible with : Coppermine 1.3.x
//
// Hacked at : 22 October 2005, 0400 +0800
//
// Copyright (C) 2005 Mohammad Hafiz bin Ismail (mypapit)
//
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//
// Report problems and direct all questions to:
//
// <mypapit@gmail.com>
//
// For latest version of this software, please visit :
//
// http://mypapit.net/pproject
// http://blog.mypapit.net/
//
// authors email : mypapit@gmail.com, papit01@lycos.com
//
//
// Modified by Wieland E. Kublun www.kublun.com on 29/September/2006
// Modified by Richard Pope pope@vatican-uk.com on 15 November 2008
//
// Now this mod displays the album's title and description
$upperlimit = 6; //default = 6
define('INC_COMMENT_TIMES', false);
define('FILEDUMP', false);
define('GZ_COMPRESS', false);
// [0.0 <= priority <= 1.0]
define('P_DISPLAYIMAGE', 0.5);
define('P_ALBUM', 0.5);
define('P_CATEGORY', 0.5);
// [changefreq = always || hourly || daily || weekly || monthly || yearly || never]
define('CF_DISPLAYIMAGE', 'unspecified');
define('CF_ALBUM', 'unspecified');
define('CF_CATEGORY', 'unspecified');
define('IN_COPPERMINE', true);
require('include/init.inc.php');
// This should work as it is, but hardcode if necessary.
define('CPG14', version_compare(COPPERMINE_VERSION, "1.4.0", ">="));
define('PHP5', version_compare(phpversion(), "5", ">="));
$base = rtrim($CONFIG['ecards_more_pic_target'], '/');
$albumpath = "$base/" . $CONFIG['fullpath'];
function lmdate($timestamp)
{
if (PHP5){
return date('c', $timestamp);
} else {
return date('D, d M Y H:i:s +0800', $timestamp - date('Z'));
}
}
// No user servicable parts below here
header("Content-type: text/xml; charset=utf-8");
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
print "<rss version=\"2.0\">";
$result = mysql_query("SELECT aid, title, description FROM {$CONFIG['TABLE_ALBUMS']} ORDER BY title ASC");
while (list($aaid, $atitle, $adescription) = mysql_fetch_row($result)) {
print "<channel>\n";
print "<title>$atitle</title>\n";
print "<link>$base</link>\n";
print "<description>$adescription</description>";
print "<language>en-GB</language>\n";
print "<lastBuildDate>" . lmdate(time()) . "</lastBuildDate>\n";
print "<generator>Coppermine RSS 2.0 Generator (1.0)</generator>\n";
$result2 = mysql_query("SELECT pid, aid, caption, ctime, title, keywords, filepath, filename, owner_name FROM {$CONFIG
['TABLE_PICTURES']} WHERE aid=$aaid ORDER BY ctime DESC, pid DESC LIMIT
0,$upperlimit");
while (list($pid, $aid,$desc, $ctime, $title, $keywords,$filepath,$filename, $owner) = mysql_fetch_row($result2)) {
print "\t<item>\n";
print "\t\t<title> $title </title>\n";
print "\t\t<link>$base/displayimage.php?pos=-$pid</link>\n";
print "\t\t<author>$owner</author>\n";
print "\t\t<pubDate>" . lmdate($ctime) . "</pubDate>\n";
print "\t\t<description>";
echo htmlentities("<p><a href=\"$base/displayimage.php?pos=-$pid\"><img src=\"$albumpath$filepath"."thumb_$filename\" alt=\"\" border=\"0px\" /></a></p>");
echo htmlentities("<a href=\"$base/displayimage.php?pos=-$pid\">$title</a><br/><br/><br/>$desc");
print "</description>\n";
print "\t\t<keywords>";
echo htmlentities("$keywords");
print "\t\t</keywords>\n";
print "\t</item>\n";
print "\n";
}
print "</channel>";
}
print "</rss>";