Created
July 19, 2013 10:10
-
-
Save rakeshtembhurne/6038128 to your computer and use it in GitHub Desktop.
CakePHP: Render view in a variable inside controlller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$view = new View($this, false); | |
$view->set(compact('some', 'vars')); | |
$html = $view->render('view_name'); |
public function template(){
$entity = TableRegistry::get('MyTable')->find()->last();
$view = new View($this->request);
$view->layout = false;
$view->set(compact('entity'));
$html = $view->render('Etiqueta'.DS.'por_aviso');
debug($html);
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For different controller view just pass the path of the .ctp file in the render() method call...