Administrator
Administrator
acrylian   2007-08-23, 09:49
#1
I did a forum and trac search and it seems no one made one now so I made one that is based on Tris' latest comments function from the zenphoto admin.php.

Place the file as rss-comments-php within the zenphoto root directory. The link for the theme files then is simplye "rss-comments.php".

Here is the code:

`

<?php

header('Content-Type: application/xml');

require_once("zen/template-functions.php");

$themepath = 'themes';

require_once("zen/zp-config.php");

?>

<rss version="2.0">

<channel>

<title><?php echo $conf['gallery_title']." - latest comments"; ?></title>

<link><?php echo "http://".$_SERVER["HTTP_HOST"].WEBPATH; ?></link>

<description><?php echo $conf['gallery_title']; ?></description>

<language>en-us</language>

<pubDate><?php echo date("r", time()); ?></pubDate>

<lastBuildDate><?php echo date("r", time()); ?></lastBuildDate>

<docs>http://blogs.law.harvard.edu/tech/rss</docs>

<generator>Acrylian's ZenPhoto Comment RSS Generator based on Tris's Latest Comments function from zenphoto admin.php</generator>

<managingEditor><?php echo $conf['admin_email']; ?></managingEditor>

<webMaster><?php echo $conf['admin_email']; ?></webMaster>

<?php

mysql_connect($conf['mysql_host'],$conf['mysql_user'],$conf['mysql_pass']);

mysql_select_db($conf['mysql_database']) or die( "Unable to select database");

$comments = query_full_array("SELECT c.id, i.title, i.filename, a.folder, a.title AS albumtitle, c.name, c.website," . " c.date, c.comment FROM ".prefix('comments')." AS c, ".prefix('images')." AS i, ".prefix('albums')." AS a " . " WHERE c.imageid = i.id AND i.albumid = a.id ORDER BY c.id DESC LIMIT 10");

foreach ($comments as $comment)

{

$author = $comment['name'];

$album = $comment['folder'];

$image = $comment['filename'];

$albumtitle = $comment['albumtitle'];

if ($comment['title'] == "") $title = $image; else $title = $comment['title'];

$website = $comment['website'];

$comment = truncate_string($comment['comment'], 123);

?>

<item>

<title><?php echo $albumtitle.": ".$title." by ".$author; ?></title>

<link><?php echo '<![CDATA[http://'.$_SERVER['HTTP_HOST'].WEBPATH.'/index.php?album='.$album.'&image='.$image.']]>';?></link>

<dc:creator><?php echo $author; ?></dc:creator>

<description><?php echo $comment; ?></description>

<guid><?php echo '<![CDATA[http://'.$_SERVER['HTTP_HOST'].WEBPATH.'/index.php?album='.$album.'&image='.$image.']]>';?></guid>

</item>

<?php } ?>

</channel>

</rss>

`
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.