Wednesday, April 17, 2013

Render multiple actions (with views) in Yii


Have one controller function in which it has called to different function to get the various calculations to get the data, then parse this to the template where you can then parse these into partials.
In controller
public function actionCal()
{    
     $data = array();
     $data['finance'] = $this->financeCal();
     $data['holiday'] = $this->holidayCal();                            
     $this->render('calculation', array('data'=>$data));
}
In view
<?php 
$this->renderPartial('//cal/_finance_summary', array('financeData'=>$data['finance']));  
$this->renderPartial('//cal/_holioday_summary', array('holidayData'=>$data['holiday']));  
?>

No comments:

Post a Comment