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

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -