Use the source tab below to compare the rendered template to the source to use how you can use ViewFish Templating.
This is a test of ViewFish. It was written by Adam Scheinberg. It is written in PHP.
The quick brown fox jumped over the lazy dog.
<?php
# require the templating library
require '../source/ViewFish.php';
# first, you instantiate a ViewFish object
$T = new ViewFish\viewfish();
# set the template path
$T->set_template_path(__DIR__.'/../templates/');
# define our variables
$vars = [
'software_title' => "ViewFish",
"author" => "adam scheinberg",
'language' => "php",
'longstring' => "The quick brown fox jumped over the lazy dog"
];
# load template by passing either the file in the templates folder OR a hard coded path
# when searching the template directory, if no file extension is provided and no file is matched without an extension,
# it will assume ".tmpl" or ".tpl"
$template = $T->load_template("demo0.tmpl");
# compile the template
$html = $T->render($template,$vars);
# echo the template
echo $html;
<html>
<head>
<title>A Simple Demo of {{software_title}}</title>
</head>
<body>
<h1>WELCOME TO {{software_title|strtoupper}}</h1>
<p>This is a test of {{software_title}}. It was written by {{author|ucwords}}. It is written in {{language|upper}}.</p>
<p>{{longstring}}.</p>
</body>
</html>