注:由于水平有限,欢迎指正。转载请务必注明出处。
| Attribute Name | Type | Required | Default | 描述 | 
|---|---|---|---|---|
| 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 属性,该属性指明模板资源的位置.
如果设置了 assign 属性,该属性对应的变量名用于保存待包含模板的输出,这样待包含模板的输出就不会直接显示了。
| 
					Example 7-6. function include 
 | 
可以在属性中传递参数给待包含模板. 传递给待包含模板的参数只在待包含模板中可见. 如果传递的参数在待包含模板中有同名变量,那么该变量被传递的参数替代.
| 
					Example 7-7. function include passing variables 
 | 
包含 $template_dir 文件夹之外的模板请使用 模板资源 说明的格式.
| 
					Example 7-8. function include template resource examples 
 | 
原文:http://www.cnblogs.com/danmao/p/4297609.html