Created
September 17, 2011 12:40
-
-
Save jinwei233/1223907 to your computer and use it in GitHub Desktop.
PHP 模板 例子
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once("../../app/tpl-engine/Haanga.php"); | |
$str = " | |
Hi {{name}}! Welcome to Koubei.com | |
{# foreach #} | |
{% for n in numbers %} | |
<div>{{n}}</div> | |
{% endfor %} | |
"; | |
$tpl = Haanga::compile($str); | |
$data["name"] = "tom"; | |
$data["numbers"] = array("1"=>"one","2"=>"two"); | |
echo $tpl($data); | |
/////////////////////////////模板//////////////////////////////// | |
Haanga::configure(array( | |
'template_dir'=>"./", | |
"cache_dir"=>"./cached", | |
)); | |
Haanga::Load("tpl.html",$data); | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment