摘要:檔案包含:demo5.html:{include file = "public/title.html" assign = "title" brand = "華帝"}//include file = "public/title.html"這句是将title.html這個檔案包含進來,即将title.html檔案内容引用到
檔案包含:
demo5.html:
{include file = "public/title.html" assign = "title" brand = "華帝"}//include file = "public/title.html"這句是将title.html這個檔案包含進來,即将title.html檔案内容引用到demo5.html檔案中,assign = "title"是将引用進來的内容存到title變量中,brand = "華帝"是将變量brand的内容傳給title.html中。
{$title}
title.html:
中消協向{$brand}發出約談函
模闆繼承:
layout.html://父模闆
...
{block name = "title"}頁面标題{/block}//block标簽之間的為父模闆的區塊
...
demo6.html//模闆檔案
{extends file = "layout.html"}//有點類似類,模闆檔案繼承父模闆,包含檔案是include,繼承是extends
{block name = "title"}//執行個體化父模闆中的區塊
... //内容自己填寫
{$smarty.block.parent}//也可以直接繼承父模闆的内容
{/block}
批改老師:歐陽批改時間:2019-01-19 13:48:06
老師總結:完成的不錯,模版要多練習,學php最終目的,就是會模版,可以上手項目,加油。