PHP一枚でもテンプレート

<?php require 'Template.php';
Temaplte()
->merge('x','x.php')
->merge('y','y.php')
->obStart()?>
<html><head></head><title></title>
<body>

<ul id="for:x">
<li id="var:x.name;attr:class=x.class"></li>
</ul>

</body></html>

こんな感じ。ob_startでHTMLの出力をバッファリングして
Templateのインスタンスがdestructされる際にバッファリングからHTMLを
取得してパースして、ごにょごにょして。後はキャッシュとかも行って

mergeメソッドでファイルからインスタンス
を取得して何かの変数に代入しておいて
その値を使ってテンプレートとマージして

そして出力。PHP一枚でテンプレートになって
一寸カッコイイかも?

<?php (require 'Template.php')->merge('x','x.php')->obStart();?>
<html><head></head><title></title>
<body>

<ul id="for:x">
<li id="var:x.name;attr:class=x.class"></li>
</ul>

</body></html>

ほんとはこんな感じに書けたらスバラシイ。