did it my way --> need rss syndication for custom components
Posted: Fri May 01, 2009 8:36 pm
I am trying to find out how to create rss syndication for custom components, but can't find any info on this.
I see in com_content the views have a 'view.feed.php' in addition to 'view.html.php'. I created a similar file for my component but there must be more to it because I'm not getting anything.
If anyone can point me in the right direction it would be greatly appreciated! TIA.
UPDATE:
I couldn't figure out the Joomla way (looking at mod_syndicate) so I did it the easy way ;-). Would appreciate any feedback regarding what I did, if it makes sense, etc.
Created a new view in the frontend component called feed, whose tmpl is coded as follows:
This rss feed validates with feedvalidator.org. What do you think, does doing it this way make sense?
I see in com_content the views have a 'view.feed.php' in addition to 'view.html.php'. I created a similar file for my component but there must be more to it because I'm not getting anything.
If anyone can point me in the right direction it would be greatly appreciated! TIA.
UPDATE:
I couldn't figure out the Joomla way (looking at mod_syndicate) so I did it the easy way ;-). Would appreciate any feedback regarding what I did, if it makes sense, etc.
Created a new view in the frontend component called feed, whose tmpl is coded as follows:
Code: Select all
<?php header('Content-type: text/xml'); ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title><?php echo htmlentities(strip_tags($feedtitle)); ?></title>
<description><?php echo htmlentities(strip_tags($feeddesc)); ?></description>
<link><?php echo $currentDomain; ?></link>
<copyright><?php echo htmlentities(strip_tags($copyright)); ?></copyright>
<?php foreach ($items as $item) { ?>
<item>
<title><?php echo htmlentities(strip_tags($item->title)); ?></title>
<link><?php echo htmlentities($itemlink.$item->id); ?></link>
<description><?php echo htmlentities(strip_tags($item->description,'ENT_QUOTES')); ?></description>
<pubDate><?php echo date( "D, d M Y H:i:s T " ,strtotime($item->publish_up) ); ?></pubDate>
</item>
<?php } ?>
</channel>
</rss><?php exit;