Location: PHPKode > projects > Vemplator > example/example.phps
<?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());

echo $t->output('example.template.html');
?>
Return current item: Vemplator