下载地址:https://github.com/wudimeicom/rongframework
/test/tpl_wudimei/extends.php
<?php
/**
* file encoding utf-8
* 文件字符编码utf-8
*/
$PathToRongFramework = dirname(__FILE__)."/../../lib";
$PathToRongFrameworkDev = dirname(__FILE__)."/../../../www.wudimei.com/lib";
if( is_dir( $PathToRongFrameworkDev )){ $PathToRongFramework = $PathToRongFrameworkDev; }
set_include_path( "." . PATH_SEPARATOR . $PathToRongFramework . PATH_SEPARATOR . get_include_path() );
require_once 'Rong/View/Wudimei.php';
$wudimei = new Rong_View_Wudimei();
$wudimei->compileDir = dirname(__FILE__) . "/templates/compiled";
$wudimei->viewsDirectory = dirname(__FILE__) . "/templates";
$wudimei->leftDelimiter = "<!--{";
$wudimei->rightDelimiter = "}-->";
$wudimei->forceCompile = true;
//assing var msg to template
$wudimei->assign("keyword", "WuDiMei.com");
$wudimei->display("extends/3.html");
//print_r( $wudimei->viewBlocks );
\test\tpl_wudimei\templates\extends\1.html
<html>
<head>
<title>模板继承示例</title>
<style type="text/css">
body{}
.wBlock{ width:1000px;margin-left:auto;margin-right:auto;height:100px; }
.wTop{ background-color:#E0EAEA; }
.wTop h1{ padding:5px;}
.wContent{}
.wMenu{width:200px;float:left;}
.wDetail{width:790px;float:right;}
.wClear{clear:both;}
.wFooter{ background-color:#EAEAEA;text-align:center;}
</style>
<!--{block.append name=""}-->
</head>
<body>
<div class="wBlock wTop">
<h1>Rong Framework inherit(extends)</h1>
</div>
<div class="wBlock">
<!--{block.display name="content"}-->
</div>
<div class="wBlock wFooter">
wudimei.com版权所有
</div>
</body>
</html>
\test\tpl_wudimei\templates\extends\2.html
<!--{extends file="extends/1.html" }-->
<!--{block name="content"}-->
<div class="wContent">
<div class="wMenu"><!--{block.display name="menu"}--></div>
<div class="wDetail"><!--{block.display name="detail"}--></div>
<div class="wClear"></div>
</div>
<!--{/block}-->
\test\tpl_wudimei\templates\extends\3.html
<!--{extends file="extends/2.html" }-->
<!--{block name="menu"}-->
<a href="#">About Us</a><br />
<a href="#">Contact Us</a><br />
<a href="#">Product</a><br />
<!--{/block}-->
<!--{block name="detail"}-->
<form action="">
keywords: <input type="text" name="keywords" value="<!--{$keyword}-->" /> <input type="submit" value="query" />
</form>
<!--{/block}-->