Smarty - the compiling PHP template engine | ||
---|---|---|
Prev | Chapter 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* | 需继承的模板名 |
Prev | Home | Next |
{debug} 调试 | Up | {for} |