Rendering different view in controller CakePHP
here you can use different view in a controller function.
See Example Below.
function nursingpaymentdetail($intStaffId,$strType) { $this->viewBuilder()->setLayout('withoutheader'); if($strType=='earning') { $this -> render('Dashboard/nursingpaymentdetail'); }else{ $this -> render('Dashboard/nursingperformance'); } }
Here $this -> render function use to render different view in a controller class function.
As the answer above mentions, you can use $this -> set to pass a variable to the View.
Share