Guest User

Untitled

a guest
Jun 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2.  
  3. use Cake\Filesystem\File;
  4. use Cake\View\View;
  5.  
  6. /* ... */
  7.  
  8. // Instanciates a new View class.
  9. $view = new View();
  10.  
  11. // Pass your data to the View object.
  12. $view->set('foo', $foo);
  13. $view->set('bar', $bar);
  14.  
  15. // Creates a new file, writes down the rendered view and closes it afterwards.
  16. $file = new File(WWW_ROOT . 'your/path/to/your/file.html', true);
  17. $file->write($view->render(false, 'your_layout')); # `Templates/Layout/your_layout.ctp`
  18. $file->close();
Add Comment
Please, Sign In to add comment