ViewFish templating

Basics

ViewFish is a simple PHP templating library that is designed to be extremely simple to use. There are three steps to using a ViewFish template.

First, you instantiate the object and, optionally, pass it the path to templates.

$t = new ViewFish\viewfish();

Next, you load your template of choice:

$template = $t->load_template('/path/to/template-name.tmpl');

Finally, you pass an associative array to the rendering function:

$html = $t->render($template,$data);

That's it. $html will now contain your ready-to-go output.

You could also the same thing like this:

$t = new ViewFish\viewfish('/path/to/templates/');
$template = $t->load_template('template-name');
$html = $t->render($template,$data);

You can see examples of Viewfish at sethadam1.com/code/ViewFish/examples/