-
Notifications
You must be signed in to change notification settings - Fork 30
Core\Viewer
Fariz Luqman edited this page Jun 29, 2016
·
3 revisions
The Viewer will read the HTML file and outputs it to the screen. Viewer will also inject dependencies from the Core\App and Core\Sharer. See this file.
You can call the viewer in the app/routes.php file by doing this:
Router::get('/', function() {
Viewer::file('home.php');
});Or from the views folder:
Router::get('/', function() {
Viewer::file('views/home.php');
});Or you can also pass a data:
Router::get('/', function() {
Viewer::file('home.php', ['name' => 'John Doe']);
});And later can be displayed on the HTML file:
<html>
<body><h1>My name is <?= $name; ?></h1></body>
</html><html>
<?php $app->cachemanager->set("name", "John Doe", 600); ?>
<body><h1>First user: <?= $app->cachemanager->get("name") ?></h1></body>
</html>