PHP warning

Invalid argument supplied for foreach()

/home/storage/b/e5/82/poligeomeca/public_html/protected/views/home/index.php(94)

082         <!-- Últimas notícias -->
083         <aside>
084             <h2>ÚLTIMAS NOTÍCIAS</h2>
085             <span class="my-icon my-icon-detail-news">&nbsp;</span>
086 
087             <?php 
088 
089                 $feed = Yii::app()->cHome->getFeedToHome();
090                 $i = 0;
091 
092                 if(count($feed)){
093  
094                     foreach($feed->channel->item as $item){
095                         
096                         if($i < 2){
097 
098                             //Tratando a data da publicação.
099                             $data = substr(substr($item->pubDate, 5),0,-20);
100                             
101                             preg_match_all(
102                                 '/(<img.*?src=[\'|"])' . // A tag da imagem até src=' ou "
103                                 '([^\'|"]*)'           . // O endereço
104                                 '([\'|"].*?\/?\>)'     . // Fechamendo do src e o resto da tag de imagem
105                                 '/mi',                   // PCRE_MULTILINE e PCRE_CASELESS 
106                                 $item->content,                   // O HTML

Stack Trace

#4
+
 /home/storage/b/e5/82/poligeomeca/public_html/protected/controllers/HomeController.php(46): CController->render("index", array("trabalhos" => array(PortfolioItem, PortfolioItem, PortfolioItem, PortfolioItem, ...)))
41         /* Setando as meta tags da página */
42         $this->metaTags = Yii::app()->cHome->getMetaTags();
43 
44         
45         $data['trabalhos'] = PortfolioItem::model()->ativos()->visivel()->asc_posicao()->findAll();
46         $this->render('index', $data);
47     }
48 
49     /**
50      * Página 404 - Not Found
51      */
#12
+
 /home/storage/b/e5/82/poligeomeca/public_html/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11 
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
14 
15 ?>
16 
17 
18 
2024-03-29 09:43:32 Apache Yii Framework/1.1.15