Pages (2):    1 2
Member
Member
Alenonimo   2007-08-15, 04:06
#21
Oh yea… Put this on the templates, inside the <head> tags.

`<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.php" />`

This will allow the feed autodiscovery for browsers.
Member
Member
Alenonimo   2007-08-15, 04:10
#22
Just an tip for the FeedBurners. Edit the [b].htaccess[/b] to include this:

`RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} !FeedBurner

RewriteRule ^rss.php$ http://feeds.feedburner.com/your-feedburner-feed [R,L]`

This will redirect people acessing your rss.php to your FeedBurner. Just won't redirect the FeedBurner itself.
Administrator
Administrator
acrylian   2007-08-20, 10:21
#23
I did a little expanding modification that might be useful. The RSS generator is now capable to generate a newsfeed for any album now, too.

Usage:

Save the code as "rss.php" within your theme folder then place the links into your themes:

1) On any theme file the common rss feed for the whole gallery:

`RSS`

2) On album.php and image.php the album rss feed for the currently selected album:

`<a>&albumname=<?php printAlbumTitle(); ?>">RSS for this album</a>`

Or you can place the rss.php within the zenphoto root in this thread:folder and called it via your theme like this:

`RSS`

or

`<a>&albumname=<?php printAlbumTitle(); ?>">RSS for this album</a>`

Here is the code:

`

<?php

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

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

$themepath = 'themes';

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

$albumnr = $_GET[albumnr];

$albumname = $_GET[albumname];

if ($albumname != "")

{ $albumname = " - album: ".$_GET[albumname]; }

?>

<rss version="2.0">

<channel>

<title><?php echo $conf['gallery_title']; ?><?php echo $albumname; ?></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 RSS Generator based on Alenônimo's ZenPhoto RSS Generator which is based on ThinkDreams' Generator...:-)</generator>

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

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

<?php

$iw = $cw = 300; // Image Width

$ih = $ch = 300; // Image Height

$items = 10; // # of Items displayed on the feed

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

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

if ($albumnr != "")

{ $sql = "SELECT * FROM ". prefix("images") ." WHERE albumid = $albumnr ORDER BY id DESC LIMIT ".$items;}

else

{ $sql = "SELECT * FROM ". prefix("images") ." ORDER BY id DESC LIMIT ".$items; }

$result = mysql_query($sql);

while($r = mysql_fetch_array($result)) {

$id=$r['albumid'];

if ($albumnr2 != "")

{ $sql="SELECT * FROM ". prefix("albums") ." WHERE id = $albumnr2"; }

else

{ $sql="SELECT * FROM ". prefix("albums") ." WHERE id = $id"; }

$album = mysql_query($sql);

$a = mysql_fetch_array($album);

?>

<item>

<title><?php echo $r['title'] ?></title>

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

<description><?php echo '<![CDATA[<a title="'.$r['title'].' in '.$a['title'].'">[img]http://'.$_SERVER[[/img]</a>

' . $r['desc'] . '

]]>';?> <?php if($exif['datetime']) { echo '<![CDATA[Date: ' . $exif['datetime'] . '

]]>'; } ?></description>

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

</item>

<?php } ?>

</channel>

</rss>

`
Administrator
Administrator
acrylian   2007-08-20, 10:26
#24
Sorry seems the forum does not like when I am posting...the usage part gets mangled.

So just download here:
rss-for-gallery-and-albums
Member
Member
thinkdreams   2007-08-24, 16:28
#25
Works for me. Good replacement for what I had been using, as it uses the db settings from the zp_config, rather than duplicating them in the rss.php file.
Member
Member
Alenonimo   2007-10-02, 00:48
#26
acrylian,

Your version is very good, but I have a suggestion to do. Could you put an `<br/>` between the image and description at the feed items?

And the `getIDforAlbum()` function make some weird errors when I put it on my template. What could be causing it?
Pages (2):    1 2
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.