Get Smarty

Donate

Donate Bitcoin Bitcoin
Paypal

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Buy cheap eyeglasses from Cheapglasses123.com and save up to 80%.

Buy prescription glasses from www.australiaglasses.com and save.

Cheap Glasses Now On Sale at GlassesPeople.com. Starts At $7.95.

Where to buy discount wedding dresses and cheap smart dresses free shipping - Weddingdresstrend.com

Brautkleider auf Topwedding.de

Find free files to download on allwhatyouwant.net

Looking For Affordable Wedding Dresses 2015 at Best Prices On TDBridal.com

Shop high quality cheap prom dresses on Dresswe.co.uk

Buy New Arrival Cheap Prom Dresses 2015 at JDBRIDAL Prom Dress Store

Advertisement

扩展模板资源

extends:扩展资源使用在定义父/子关系的模板继承中。 详情参见模板继承

Smarty 3.1后,extends:资源可以使用任何类型的 资源, 包括string:eval:。 当使用字符串资源的时候,确保其已经被编码(URL编码或base64编码)。 在继承链条中的eval:资源, “不保存编译文件”的特性将被extends:取代。 继承链条中的多个模板不会分开编译,而是仅会生成一个单独的编译文件。

Note

当需要继承的时候使用这个。 当在PHP代码中使用继承,子模板的覆盖看起来不是很明显。 如果可以选择,这是一个更灵活和直接的方式来处理模板继承。

Example 16.9. 使用模板继承


<?php
$smarty->display('extends:parent.tpl|child.tpl|grandchild.tpl'); 

// 从多个模板资源中继承
$smarty->display('extends:db:parent.tpl|file:child.tpl|grandchild.tpl|eval:{block name="fooBazVar_"}hello world{/block}'); 
?>

  

参见 模板继承 {block}{extends}.

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 0 plus 20? (Are you human?)

Advertisement