SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 122 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

ietf.org/html/rfc4287.
This example shows how we can build a feed; this would be located in a display()
method in a view class that deals with feeds.
// set the basic link
$document =& JFactory::getDocument();
$document->setLink(JRoute::_('index.php?option=com_myextension');
// get the items to add to the feed
$db =& JFactory::getDBO();
$query = 'SELECT * FROM #__myextension WHERE published = 1';
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $row)
Chapter 4
[ 89 ]
{
// create a new feed item
$item = new JFeedItem();
// assign values to the item
$item->author = $row->author;
$item->category = $row->category;
$item->comments = JRoute::_(JURI::base().'index.php?option=
com_myextension&view=comments&id='.$row->id);
$item->date = date('r', strtotime($row->date));
$item->description = $row->description;
$item->guid = $row->id;
$item->link = JRoute::_(JURI::base().'index.php?option=
com_myextension &id='.$row->id);
$item->pubDate = date();
$item->title = $row->title;
$enclosure = new JFeedEnclosure();
$enclosure->url = JRoute::_(JURI::base().


Pages:
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134