TWIG
I would recommend using Twig
- extensible syntax
- efficient
- compiles and caches your templates to PHP classes with a very small overhead
- sandbox mode to evaluate untrusted template code
- unit tested
- great documentation
- multiple template inheritance, template blocks, automatic output-escaping
Also read Fabien Potencier's blog post, where he explains needs for a powerful and customizable template engine.
TWIG Template code
{% extends "layout.html" %}
{% block title %}
{{ page.title|escape|title }}
{% endblock %}
{% block content %}
Content of the page...
{% for user in users %}
* {{ user.name }}
{% else %}
No user has been found.
{% endfor %}
{% endblock %}
{# this is a comment in twig syntax #}
Symfony Components
Also if you need additional components for web development, but you already have a defined code base, have look at Symfony Components which includes additional templating component (mentioned in XUE Can answer)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…