### 全局配置方式
首在config目錄中的template.php配置
'layout_on' => true,
'layout_name' => 'layout',
在view中創建header.html,footer.html,layout.html
在layout.html中
{include file="header" /}
{__CONTENT__}
{include file="footer" /}
然后在index.html中只寫主體部分就可以了。
><span style="color:red;"> 注:如果在某個頁面中不想用模板布局的話,可以用{__NOLAYOUT__}關閉,具體在你不要模板布局的頁面中的頂部加入即可。</span>
### 模板繼承
要先關閉'layout_on' => false,
在view的同目錄下建立public目錄,然后在其建立heaer.html,footer.html,base.html
在base.html中寫入如下代碼:
```
{include file="public/header1" /}
{block name="body"}
```
主體
{/block}
{include file="public/footer1" /}
然后在主模板文件index.html中繼承base.html
```
{extend name="public/base" /}
{block name="body"}
這是主體內容
{/block}
```
也可以用block加載include
```
{block name="header"}
{include file="public/header1" /}
{/block}
{block name="body"}
主體
{/block}
{block name="footer"}
{include file="public/footer1" /}
{/block}
```
一定要全部將base中的block全部實現,有幾個實現幾個;
{__block__}可以將base中的默認定義的內容顯示出來;
在父模板(base.html)中只允許出block與include標簽,在繼承模板(index.html)中只允許出現block和extend標簽。