Smarty include
来源:互联网 发布:淘宝上怎么找人工客服 编辑:程序博客网 时间:2024/06/11 07:01
include
Include 标签用于在当前模板中包含其它模板. 当前模板中的变量在被包含的模板中可用. 必须指定 file 属性,该属性指明模板资源的位置.
如果设置了 assign 属性,该属性对应的变量名用于保存待包含模板的输出,这样待包含模板的输出就不会直接显示了。
Example 7-6. function include
例 7-6. include 函数演示
{include file="header.tpl"}{* body of template goes here *}{include file="footer.tpl"}
可以在属性中传递参数给待包含模板. 传递给待包含模板的参数只在待包含模板中可见. 如果传递的参数在待包含模板中有同名变量,那么该变量被传递的参数替代.
Example 7-7. function include passing variables
例 7-7. 带传递参数的 include 函数演示
{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"}
包含 $template_dir 文件夹之外的模板请使用 模板资源 说明的格式.
Example 7-8. function include template resource examples
例 7-8. 使用外部模板资源的 include 函数演示
{* 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"}
0 0
- Smarty include
- smarty-内建函数(include)
- smarty 给include file 加扩展
- smarty循环,include,if,literal,strip
- smarty中的几个常用函数 templateExists() fetch() include
- Smarty
- Smarty
- smarty
- smarty
- Smarty
- smarty
- smarty
- smarty
- smarty
- smarty
- smarty、
- smarty
- smarty
- windows 下查看网络连接数
- U盘安装Ubuntu 14.04报“CD-couldn't be mounted”的处理
- Android 之 LayoutInflater
- JAVA-原型模式
- linux开启防火墙挂载nfs
- Smarty include
- 可实现随意切换的button同时随切换改变title的颜色
- 为什么你应该停止使用EventBus
- Objective-C 汤姆猫动画实现
- Activity与Activity之间的信息传递、传值
- 适用于PHP初学者的学习线路和建议
- MPAndroidChart 教程:开始 Getting Started(一)
- Smarty assign用法
- android Timer 简单好用