コード例 #1
0
 private function assignFeedContent()
 {
     $feedcontent = null;
     // get Feed Data (from Cache or File)
     $feedcontent = Clansuite_Feed::fetchRawRSS('http://groups.google.com/group/clansuite/feed/rss_v2_0_topics.xml');
     // try to read as xml
     if (is_null($feedcontent) == false) {
         if (class_exists('SimpleXMLElement')) {
             $xml = new SimpleXMLElement($feedcontent);
         } else {
             throw new Clansuite_Exception('SimpleXMLElement class does not exist!', 100);
         }
     } else {
         throw new Clansuite_Exception('Feed could not be read.', 100);
         #Clansuite_Logger::log('', $e);
         $xml = '';
     }
     // set output var
     $output = '';
     // process output
     $i = 0;
     $max_rss_items = self::getConfigValue('news_rss_items', '5');
     foreach ($xml->channel->item as $items) {
         $i++;
         $output .= '<p><strong>#' . $i . ' - <a href="' . $items->link . '">' . htmlspecialchars($items->title) . '</a></strong><br />';
         $output .= '<span style="font-size: 11px;">' . htmlspecialchars($items->pubDate) . '</span><br /></p>';
         // show 10 items @todo configvalue for itemnumber
         if ($i == $max_rss_items) {
             break 0;
         }
     }
     return $output;
 }
コード例 #2
0
 public function widget_rssreader()
 {
     // fetch the google group clansuite for latest news
     $feeditems = Clansuite_Feed::fetchRSS('http://groups.google.com/group/clansuite/feed/rss_v2_0_topics.xml');
     // assign to smarty
     $view = $this->getView();
     $view->assign('items_newswidget', self::getConfigValue('items_newswidget', '3'));
     $view->assign('feed', $feeditems);
 }