Use native PHP templating

<?php
/* Use native PHP templating.
 *
 * See also:
 * http://www.php.net/manual/en/control-structures.alternative-syntax.php
 */

class Templating {

    function Templating($path, $extension='.tpl') {
        if (substr($path, -1) != '/') {
            $path .= '/';
        }
        $this->path = $path;
        $this->extension = $extension;
    }

    function render($file, $vars) {
        if (is_array($vars)) {
            # Extract the vars to local namespace.
            extract($vars);
        }
        # Include the file and catch the output using buffering.
        ob_start();
        include($this->path . $file . $this->extension);
        $contents = ob_get_contents();
        ob_end_clean();
        return $contents;
    }
}

# Example usage.
$tpl = new Templating('./templates/');
# Render the template `./templates/servers_list.tpl`.
echo $tpl->render('servers_list');
?>