News Module RSS, Pictures and Links

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
jeffunk
Forum Members
Forum Members
Posts: 32
Joined: Thu Mar 16, 2006 3:17 am

News Module RSS, Pictures and Links

Post by jeffunk »

As an avid RSS reader.  I thought it would be nice if I could include the pictures and links that are put into the news items in the RSS feed.  Luckily it was pretty easy to do!  I don't doubt that many people are already doing this but for anyone who like me thought it would be nice, but couldn't see how to do it right away.  Here's my solution so far.

The only change the needs to be made is just to the template file (rssfeed.tpl )  The code below is the modified template.  The only bit that is modified is just the tag contents. So change the rssfeed.tpl file and viola! It should work in most rss readers.

I checked the rss stream that this produces at http://feedvalidator.org/ and I did get some warnings regarding the fact that the images and links should not contain relative URL references, so that is one small thing that would be nice to fix.  If anyone has an idea as to how that could be fixed let me know!

Code: Select all

<?xml version="1.0"?>
<rss version="2.0">
        <channel>
                <title>{$sitename}</title>
                <link>{$root_url}</link>
                <description>Current News entries</description>
                {foreach from=$items item=entry}
                <item>
                        <title><![CDATA[{$entry->title}]]></title>
                        <link>{$entry->link}</link>
                        <guid>{$entry->link}</guid>
                        <pubDate>{$entry->gmdate}</pubDate>
                        <category><![CDATA[{$entry->category}]]></category>
                        <description><![CDATA[{eval var=$entry->summary}
                        {eval var=$entry->content}]]></description>
                </item>
                {/foreach}
        </channel>
</rss>
Post Reply

Return to “Modules/Add-Ons”