天天看點

tp5.1 前台模闆使用公共模闆網頁(header.html、foot.html、base.html)

1、在app\index\controller檔案夾建立一個名為Lyot(自定義)的控制器,在控制器中定義:

  

tp5.1 前台模闆使用公共模闆網頁(header.html、foot.html、base.html)
tp5.1 前台模闆使用公共模闆網頁(header.html、foot.html、base.html)

  2、建立一個被繼承的public(自定義)檔案夾,裡面有三個檔案,分别是header.html、foot.html、base.html

  (1)header.html

tp5.1 前台模闆使用公共模闆網頁(header.html、foot.html、base.html)

  (2)foot.html

tp5.1 前台模闆使用公共模闆網頁(header.html、foot.html、base.html)

  (3)base.html

tp5.1 前台模闆使用公共模闆網頁(header.html、foot.html、base.html)

  3、建立于控制器對應的視圖檔案view/lyot/test2.html,内容:

tp5.1 前台模闆使用公共模闆網頁(header.html、foot.html、base.html)

  4、通路位址:localhost/安裝架構路徑/public/index.php/index/lyot/test2,

    (1)效果1:正常通路情況

tp5.1 前台模闆使用公共模闆網頁(header.html、foot.html、base.html)

  

    (2)效果2:顯示編輯内容的同時,也顯示預設的内容:

        1)test2.html部分:    

tp5.1 前台模闆使用公共模闆網頁(header.html、foot.html、base.html)

      

        2)效果:

  

tp5.1 前台模闆使用公共模闆網頁(header.html、foot.html、base.html)

    以上

繼續閱讀