Skip to content
Lode Claassen edited this page Apr 27, 2016 · 2 revisions

Use page to render html to the browser. It is a handy wrapper around mustache.

Basics

Render a template with data

$template_data = array(
	'greeting' => 'Hello',
	'planet'   => 'World',
);

$page = new fem\page('Home');
$page->show('home', $template_data);

This will load a template from application/templates/home.html and use mustache to render it.

Render a static template

$page = new fem\page();
$page->show('some_group/a_template');

This will load a template from application/templates/some_group/a_template.html.

Set browser title

$page = new fem\page('Custom title to appear in the browser tab');
$page->show('home');

Extras

Showing error or exception

todo

Adjust default error template

todo

Syntax

void __construct(string $title=null)
void show(string $template, array $data=[])

Remarks

Template location

Templates are searched in application/templates directory. See mustache for changing that location.

You can’t perform that action at this time.