'News', 'description' => 'News', 'link' => $this->getUrl('clnews/rss'), 'charset' => 'UTF-8', 'language' => Mage::getStoreConfig('general/locale/code') ); $rssObj->_addHeader($data); $collection = Mage::getModel('clnews/news')->getCollection() ->addStoreFilter(Mage::app()->getStore()->getId()) ->setOrder('created_time ', 'desc'); $categoryId = $this->getRequest()->getParam('category'); if ($categoryId && $category = Mage::getSingleton('clnews/category')->load($categoryId)) { $collection->addCategoryFilter($category->getUrlKey()); } $collection->setPageSize((int)Mage::getStoreConfig('clnews/rss/posts')); $collection->setCurPage(1); if ($collection->getSize()>0) { foreach ($collection as $item) { $data = array( 'title' => $item->getTitle(), 'link' => $this->getUrl("clnews/newsitem/view", array("id" => $item->getId())), 'description' => $item->getShortContent(), 'lastUpdate' => strtotime($item->getNewsTime()), ); $rssObj->_addEntry($data); } } else { $data = array('title' => Mage::helper('clnews')->__('Cannot retrieve the news'), 'description' => Mage::helper('clnews')->__('Cannot retrieve the news'), 'link' => Mage::getUrl(), 'charset' => 'UTF-8', ); $rssObj->_addHeader($data); } return $rssObj->createRssXml(); } }