include

PHP Smarty

Smarty - the compiling PHP template engine
Prev 来源:PHP中文社区 Chapter 7. Built-in Functions[第七章.内建函数] Next

include

Attribute Name Type Required Default Description
file string Yes n/a The name of the template file to include
assign string No n/a The name of the variable that the output of include will be assigned to
[var ...] [var type] No n/a variable to pass local to template
属性 类型 是否必须 缺省值 描述
file string Yes n/a 待包含的模板文件名
assign string No n/a 该属性指定一个变量保存待包含模板的输出
[var ...] [var type] No n/a 传递给待包含模板的本地参数,只在待包含模板中有效
{include file="header.tpl"}

{* body of template goes here *}

{include file="footer.tpl"}
{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"}

{* body of template goes here *}

{include file="footer.tpl" logo="http://my.domain.com/logo.gif"}
{* absolute filepath *}
{include file="/usr/local/include/templates/header.tpl"}

{* absolute filepath (same thing) *}
{include file="file:/usr/local/include/templates/header.tpl"}

{* windows absolute filepath (MUST use "file:" prefix) *}
{include file="file:C:/www/pub/templates/header.tpl"}

{* include from template resource named "db" *}
{include file="db:header.tpl"}

Prev 来源:PHP中文社区 Home Next
total Up include_php