<?php
error_reporting(E_ALL);
include('../vemplator.php');
// if templates reside in a different directory:
// set_include_path( get_include_path() . PATH_SEPARATOR . '/var/www/templates');
$t = new vemplator();
// we don't set a compilePath because we want it to use /tmp/HOSTNAME
// if/else
$t->assign('ifTest', 'this is a string');
$t->assign('ifTest2', null);
// switch
$t->assign('switchTest', 'vemplator');
$t->assign('other', 'Smarty');
// loops
$rows = array(
array(
'name' => 'Alan'
),
array(
'name' => 'Frank'
)
);
$t->assign('rows', $rows);
class user {
public $name;
function __construct() {
$this->names = array(
'first' => 'Timothy',
'last' => 'Scott'
);
}
public function fullName() {
return implode(' ', $this->names);
}
}
$t->assign('obj', new user());
class keys {
public $a;
function __construct() {
$this->a = new keys2();
}
}
class keys2 {
public $a;
function __construct() {
$this->a = 'name';
}
}
$t->assign('keys', new keys());
echo $t->output('example.template.html');
?>