PHP头条
热点:

thinkphp模板的包含与渲染


一、模板包含

  1. (include file="完整模板文件名" /) 
  2.         (include file="./Tpl/default/Public/header.html" /) 
  3.         (include file="read" /)//调用同级目录下的read模板 
  4.         (include file="Public:header" /) 
  5.         (include file="blue:User:read" /) 
  6.         (include file="$tplName" /) 
  7.         (include file="header" title="ThinkPHP框架"keywords="开源WEB开发框架"/) 

在模板中变量用[变量]接受

(include file='file1,file2' /)

二、模板渲染

1、自动开启模板渲染 设置配置文件,替换文件中的特定内容,组装成完整页面.

'LAYOUT_ON'=)true,//开启模板渲染

在Public公共目录下,准备一个layout模板渲染页面,在页面中使用{__CONTENT__}引用具体模板页面的内容.

如果在一个具体模板中不希望使用渲染模板,可以在页首添加{__NOCONTENT__}

2、不开启自动模板渲染可以在每一个具体页面的页首添加

(layout name='layout'/)

www.phpzy.comtrue/phpkj/603.htmlTechArticlethinkphp模板的包含与渲染 一、模板包含 (include file = "完整模板文件名" /) (include file = "./Tpl/default/Public/header.html" /) (include file = "read" /)//调用同级目录下的read模板 (include file = "Public:heade...

相关文章

相关频道:

PHP之友评论

今天推荐