Пример #1
0
 /**
  * A method to launch and display the widget
  *
  * @param array $aParams The parameters array, usually $_REQUEST
  */
 function display()
 {
     if (!$this->oTpl->is_cached()) {
         RV::disableErrorHandling();
         $oRss = new XML_RSS($this->url);
         $result = $oRss->parse();
         RV::enableErrorHandling();
         // ignore bad character error which could appear if rss is using invalid characters
         if (PEAR::isError($result)) {
             if (!strstr($result->getMessage(), 'Invalid character')) {
                 PEAR::raiseError($result);
                 // rethrow
                 $this->oTpl->caching = false;
             }
         }
         $aPost = array_slice($oRss->getItems(), 0, $this->posts);
         foreach ($aPost as $key => $aValue) {
             $aPost[$key]['origTitle'] = $aValue['title'];
             if (strlen($aValue['title']) > 38) {
                 $aPost[$key]['title'] = substr($aValue['title'], 0, 38) . '...';
             }
         }
         $this->oTpl->assign('title', $this->title);
         $this->oTpl->assign('feed', $aPost);
         $this->oTpl->assign('siteTitle', $this->siteTitle);
         $this->oTpl->assign('siteUrl', $this->siteUrl);
     }
     $this->oTpl->display();
 }
Пример #2
0
 function isDataRequired()
 {
     return $this->draw && !$this->oTpl->is_cached();
 }