Smarty is an excellent template system used for PHP. It’s definitely the best and most versatile one I’ve seen.

Let’s say you have an index.tpl (the default template file extension in Smarty) with the following in it:

<html>
<head>
<title>Information</title>
</head>
<body>
Number 1: {$num1}<br>
Number 2: {$num2}<br>
</body>
</html>

Now, to actually use the template you would have code like the following:

$smarty = new Smarty;
$smarty->assign('num1', '111');
$smarty->assign('num2', '222');
$smarty->display('index.tpl');

As simple as that!

The output would be:

<html>
<head>
<title>Information</title>
</head>
<body>
Number 1: 111<br>
Number 2: 222<br>
</body>
</html>

That is just a simple example, and there are a lot more advanced things you can do with it. Check out the Smarty Crash Course for some ideas.