php smarty extends,{extends}

Smarty - the compiling PHP template engine
PrevChapter 7. Built-in Functions[第七章.内置函数]Next

# {extends} 继承

{extends} tags are used in child templates in template inheritance for extending parent templates. For details see section of Template Interitance.

* The {extends} tag must be on the first line of the template.

* If a child template extends a parent template with the {extends} tag it may contain only {block} tags. Any other template content is ignored.

* Use the syntax for template resources to extend files outside of the $template_dir directory.

{extends}标签用在模板继承中子模版对父模板的继承。具体的细节参考[模板继承](#)一节。

{extends}标签用在模版中的第一行;

如果子模板用{extends}标签继承父模板,那么它只能包含{block}标签(内容),其它任何模板内容都将忽略;

使用此语法为模板资源继承$template_dir目录外的文件。

**Attribute: **

| Attribute Name | Type | Required | Default | Description |

|-----|-----|-----|-----|-----|

| file | string | yes | *n/a* | The name of the template file which is extended |

**属性: **

| 属性名 | 类型 | 是否必须 | 缺省值 | 描述 |

|-----|-----|-----|-----|-----|

| file | string | yes | *n/a* | 需继承的模板名 |

Example 7.26. Simple {extends} example 例 7-26.简单的{extends} 模板
{extends file='parent.tpl'}{extends 'parent.tpl'}  {* short-hand *}

See also Template Interitance and {block}.
参考模板继承{block}

PrevHomeNext
{debug}
调试
Up{for}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值