aboutsummaryrefslogtreecommitdiff
path: root/lib/PhpTemplate.php
blob: 8dd6f72ad275f13eed2a9bdc63f1a6208ecd3883 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

// Version 1.2

if(!function_exists('h'))
{
	function h($s)
	{
		return htmlspecialchars($s);
	}
}

class PhpTemplate
{
	public function __construct($file)
	{
		$this -> file = $file;
	}

	public function render($___data = array())
	{
		extract((array)$___data);
		unset($___data);

		ob_start();
		include($this->file);
		return ob_get_clean();
	}
	
	public function __tostring()
	{
		return $this->render();
	}
}