Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use Cake\Filesystem\File;
- use Cake\View\View;
- /* ... */
- // Instanciates a new View class.
- $view = new View();
- // Pass your data to the View object.
- $view->set('foo', $foo);
- $view->set('bar', $bar);
- // Creates a new file, writes down the rendered view and closes it afterwards.
- $file = new File(WWW_ROOT . 'your/path/to/your/file.html', true);
- $file->write($view->render(false, 'your_layout')); # `Templates/Layout/your_layout.ctp`
- $file->close();
Add Comment
Please, Sign In to add comment