CGFeedmaker and Gallery module
Posted: Wed Mar 17, 2010 8:44 pm
Hi all! After fighting for a few hours on this, I thought I'd share the template I created for creating an RSS feed out of the Gallery module. It could certainly use an expert's touch to polish it up. You can see it in action at http://www.northoftheridge.com/whats-new.
NOTE! The part after the {root_url} bit is specific to my page - you'll have change this to your own page if you don't want it directed to your root url. The reason for this is that I couldn't find a way to get an automatic hard link to each photo. (Actually, I'd like to have it link from the picture/title to the page it's on, not the image alone.)
If you can use this, awesome. If you can improve this, even better! Post revisions below.
Code: Select all
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>{$feed.title}</title>
{if isset($feed.link) && !empty($feed.link)}<link>{$feed.link}</link>{/if}
{if isset($feed.description) && !empty($feed.description)}<description>{$feed.description}</description>{/if}
{if isset($feed.copyright) && !empty($feed.copyright)}<copyright>{$feed.copyright}</copyright>{/if}
{if isset($generator)}<generator>{$generator}</generator>{/if}
{if isset($feed.managing_editor) && !empty($feed.managing_editor)}<managingEditor>{$feed.managing_editor}</managingEditor>{/if}
{if isset($admin_email)}<webMaster>{$admin_email}</webMaster>{/if}
{if isset($feed.image) && !empty($feed.image)}
<image>
{if isset($feed.description) && !empty($feed.description)}<description>{$feed.description}</description>{/if}
{if isset($feed.link) && !empty($feed.link)}<link>{$feed.link}</link>{/if}
<title>{$feed.title}</title>
<url>{$file_location}/{$feed.image}</url>
</image>
{/if}
{capture assign='photos'}
{Gallery action="showlatest" number="9"}
{/capture}
{foreach from=$images item='image'}
<item>
<title>{$image->title}</title>
<link>{root_url}/XXXXXX</link>
<description>
<![CDATA[<a href="{root_url}/XXXXXX"><img src="{root_url}/{$image->thumb}" alt="{$image->title}" /></a><br/>
{$image->comment}<hr />]]>
</description>
</item>
{/foreach}
</channel>
</rss>If you can use this, awesome. If you can improve this, even better! Post revisions below.