Extra Light PHP Framework

Views

This class is loaded automatically by the system

Content

Creating a view

<html> <head> <title><?php echo $title;?></title> </head> <body> <h1><?php echo $heading;?></h1> <p><?php echo $content;?></p> </body> </html>

Loading a view (output)

In controller: <?php if (!defined('LIB_DIR')) exit('Access Forbidden'); class Foo extends Controller { function Foo() { parent::__construct(); } function index() { $view['title'] = 'Foo'; $view['heading'] = 'Bar'; $view['content'] = 'FooBar'; View::render('view', $view); } } ?>

Loading a view (fetch)

In controller: <?php if (!defined('LIB_DIR')) exit('Access Forbidden'); class Foo extends Controller { function Foo() { parent::__construct(); } function index() { $menu['pages'] = $pages->get_all(); $view['title'] = 'Foo'; $view['heading'] = 'Bar'; $view['content'] = View::render('menu', $menu, true); View::render('view', $view); } } ?>