> 引入其他模板, 解析后會把當前標簽替換為引用的頁面內容, 嵌套包含需要注意路徑問題
~~~
// common/head.html
<div>這里是head</div>
~~~
~~~
// common/footer.html
<div>版權所有 @玩具機器人</div>
~~~
~~~
// index/index.html #display這個模板
<div php-include="common/head"></div>
<div class="main">網頁主體</div>
<div php-include="common/footer"></div>
~~~
解析后:
~~~
<div>這里是head</div>
<div class="main">網頁主體</div>
<div>版權所有 @玩具機器人</div>
~~~
> 路徑還支持模板變量哦, 可以使用assign過來的變量作為包含路徑, 可根據業務靈活包含模塊.
## 路徑問題
~~~
以下假設模板根目錄是 /web/tpl/
顯示的模板是 /web/tpl/home/index.html
<div php-include="common/footer"></div> // 引入的是 /web/tpl/common/footer.html
<div php-include="footer"></div> // 引入的是 /web/tpl/home/footer.html
<div php-include="/footer"></div> // 引入的是 /web/tpl/footer.html
<div php-include="../footer"></div> // 引入的是 /web/footer.html
~~~