cakephp - CakePHP3 Render View to a Variable -
i want render view variable without directly sending browser. used cakephp2.*. but, cannot figure out how in cakephp3. please tell me how it?
viewbuilder introduced in cakephp 3.1 , handles rendering of views. when ever want render variable go @ how send email works.
from controller:
 function index() {      // can have view variables.      $data = 'a view variable';       // create builder (hint: new viewbuilder() constructor works too)      $builder = $this->viewbuilder();       // configure needed      $builder->layout('default');      $builder->template('index');      $builder->helpers(['html']);       // create view instance      $view = $builder->build(compact('data'));       // render variable      $output = $view->render();  } 
Comments
Post a Comment