PHP warning

Invalid argument supplied for foreach()

/home/bangsaonline/public_html/amp/protected/views/front/berita/detail.php(256)

244                 </div>
245             <?php } ?>
246         <?php } ?>    
247         
248         <?php 
249                                         $str_baca = '
250                                         
251                                         <div class="blockquote-1 full-bottom">
252                                         <h5><b>BACA JUGA:</b></h5>
253                                             <p class="italic">';
254                                          ?>
255                                             <?php 
256                                             foreach ($datarelated as $key_related => $drelated): 
257                                                 if ($key_related > 3) { continue; }
258                                                 $images_related = '';
259                                                 if(!empty($drelated['filename'])){
260                                                     $images_related =  get_image_thumb($drelated['filename'],"berita","340x170", $drelated['caption_title']);
261                                                 }
262 
263                                                 $cat_ber = 'berita';
264                                                 $str_baca .= '<i class="fa fa-angle-right"></i> <a href="'.get_link_berita("berita", $drelated['news_id'], $drelated['news_slug']).'">'.$drelated['news_title'].'</a> <br>';
265                                             ?>
266                                             <?php endforeach ?>
267 
268                                         <?php $str_baca .= '</p>

Stack Trace

#4
+
 /home/bangsaonline/public_html/amp/protected/controllers/front/BeritaController.php(39): CController->render("detail", array("data" => array("news_id" => "4973", "news_title" => "Hasbiyah Sabet Predikat Duta Baca Gresik 2014", "news_content" => "<p><strong>GRESIK (bangsaonline) - </strong>Habsiyah Aini El Yaf...", "news_excerpt" => "", ...), "slugid" => "4973/hasbiyah-sabet-predikat-duta-baca-gresik-2014"))
34             }else{
35                 $dataReader = $berita_d_cache;
36             }
37             
38             if(!empty($dataReader)){        
39                 $this->render('detail', array('data' => $dataReader, 'slugid'=>$dataReader['news_id']."/".$dataReader['news_slug']));
40             }else{
41                 $this->redirect('/', 301);
42             }
43 
44         }else{
#14
+
 /home/bangsaonline/public_html/amp/protected/components/WebApplicationEndBehavior.php(25): CApplication->run()
20         // Attach the changeModulePaths event handler
21         // and raise it.
22         $this->onModuleCreate = array($this, 'changeModulePaths');
23         $this->onModuleCreate(new CEvent($this->owner));
24  
25         $this->owner->run(); // Run application.
26     }
27  
28     // This event should be raised when CWebApplication
29     // or CWebModule instances are being initialized.
30     public function onModuleCreate($event)
#16
+
 /home/bangsaonline/public_html/amp/index.php(21): CComponent->__call("runEnd", array("front"))
16 
17 if(YII_DEBUG_DISPLAY_TIME)
18 echo Yii::getLogger()->getExecutionTime();
19 
20 require_once($yii);
21 Yii::createWebApplication($config)->runEnd('front');
22 // echo "Using ", memory_get_peak_usage(1), " bytes of ram.";
23 
2024-03-29 01:45:56 Apache Yii Framework/1.1.14