Вторая версия выполняет PHP код:
Файл template_parser.php:

Код:
<?php
function show($filename, $values = NULL) 
{
  ob_start();
  if(isset($values))
    extract($values);

  include($filename);
  return ob_get_clean();
}
?>

Пример index.php:

Код:
<?php
  require_once('template_parser.php');
  echo show('main_template.php', array('title' => 'Заголовок', 'content' => 'Тут контент'));
?>

Шаблон main_template.php:

Код:
<!DOCTYPE html>
  <head>
    <title><?=$title; ?></title>
  </head>
  <body>
     <div><?=$content; ?></div>
  </body>
</html>