Wolff\Core\View
The Wolff view class is the one responsible for rendering and managing views.
render(string $dir[, array $data[, bool $cache]])
Renders a view content.
The first parameter must be the view name, the second the associative array with the content that will be used in the view, the third and optional parameter is to use or not the cache file/system.
View::render('sub/home', $data);
That will basically render the content of the app/views/sub/home.wlf file using the template system.
getSource(string $dir)
Returns a view content.
The parameter must be the view name.
View::getSource('sub/home');
That will return the content of the app/views/sub/home.wlf file.
getRender(string $dir[, array $data[, bool $cache]])
Returns a view content rendered.
The first parameter must be the view name, the second the associative array with the content that will be used in the view, the third and optional parameter is to use or not the cache file/system.
View::getRender('sub/home', $data);
That will return the rendered content of the sub/home view using the $data array.
This will do the same as above but will ignore the cache file:
View::getRender('sub/home', $data, false);
Take in mind that it can increase the loading time.
getPath(string $path)
Returns the file path of the given view.
View::getPath('sub/home');
By default that will return app/views/sub/home.wlf
exists(string $dir)
Returns true if the given view file exists, false otherwise.
View::exists('home');
That will return true only if the app/views/home.wlf file exists, false otherwise.