Made a comment rss feed

acrylian Administrator, Developer
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<br />
header('Content-Type: application/xml');

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

$themepath = 'themes';

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

?>





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

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

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

en-us

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

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

http://blogs.law.harvard.edu/tech/rss

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

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

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

<?php<br />
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);

?>



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

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

<?php echo $author; ?>

<?php echo $comment; ?>

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



<?php } ?>





`
Sign In or Register to comment.