use Cake\View\View;
$html = '';
$this->autoRender = false;
ob_start();
$view = new View($this->request);
# OR BELOW
$view = new View($this);
$view->layout = null;
/* controller name, a folder exists in views folder */
$view->viewPath = "FolderName";
/* variable send to view file */
$view->set("var", $var);
$html .= $view->render("file_name");
/* a file exists in Views/FolderName/ folder/file_name.ctp */
ob_end_clean();
$html = '';
$this->autoRender = false;
ob_start();
$view = new View($this->request);
# OR BELOW
$view = new View($this);
$view->layout = null;
/* controller name, a folder exists in views folder */
$view->viewPath = "FolderName";
/* variable send to view file */
$view->set("var", $var);
$html .= $view->render("file_name");
/* a file exists in Views/FolderName/ folder/file_name.ctp */
ob_end_clean();
No comments:
Post a Comment