mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
- renamed extend tag and resource to extens: {extends file='foo.tol'} , $smarty->display('extends:foo.tpl|bar.tpl);
This commit is contained in:
12
README
12
README
@@ -342,13 +342,13 @@ parent.tpl:
|
|||||||
</html>
|
</html>
|
||||||
|
|
||||||
child.tpl:
|
child.tpl:
|
||||||
{extend file='parent.tpl'}
|
{extends file='parent.tpl'}
|
||||||
{block name='title'}
|
{block name='title'}
|
||||||
Child title
|
Child title
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
grandchild.tpl:
|
grandchild.tpl:
|
||||||
{extend file='child.tpl'}
|
{extends file='child.tpl'}
|
||||||
{block name='title'}Home - {$smarty.parent}{/block}
|
{block name='title'}Home - {$smarty.parent}{/block}
|
||||||
{block name='page-title'}My home{/block}
|
{block name='page-title'}My home{/block}
|
||||||
{block name='content'}
|
{block name='content'}
|
||||||
@@ -377,17 +377,17 @@ If we render grandchild.tpl we will get this:
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
NOTE: In the child templates everything outside the {extend} or {block} tag sections
|
NOTE: In the child templates everything outside the {extends} or {block} tag sections
|
||||||
is ignored.
|
is ignored.
|
||||||
|
|
||||||
The inheritance tree can be as big as you want (meaning you can extend a file that
|
The inheritance tree can be as big as you want (meaning you can extend a file that
|
||||||
extends another one that extends another one and so on..), but be aware that all files
|
extends another one that extends another one and so on..), but be aware that all files
|
||||||
have to be checked for modifications at runtime so the more inheritance the more overhead you add.
|
have to be checked for modifications at runtime so the more inheritance the more overhead you add.
|
||||||
|
|
||||||
Instead of defining the parent/child relationships with the {extend} tag in the child template you
|
Instead of defining the parent/child relationships with the {extends} tag in the child template you
|
||||||
can use the extend resource as follow:
|
can use the s resource as follow:
|
||||||
|
|
||||||
$smarty->display('extend:grandchild.tpl|child.tpl|parent.tpl');
|
$smarty->display('extends:grandchild.tpl|child.tpl|parent.tpl');
|
||||||
|
|
||||||
Child {block} tags may optionally have a append or prepend attribute. In this case the parent block content
|
Child {block} tags may optionally have a append or prepend attribute. In this case the parent block content
|
||||||
is appended or prepended to the child block content.
|
is appended or prepended to the child block content.
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
- use _dir_perms and _file_perms properties at file creation
|
- use _dir_perms and _file_perms properties at file creation
|
||||||
- new constant SMARTY_RESOURCE_DATE_FORMAT (default '%b %e, %Y') which is used as default format in modifier date_format
|
- new constant SMARTY_RESOURCE_DATE_FORMAT (default '%b %e, %Y') which is used as default format in modifier date_format
|
||||||
- added {foreach $array as $key=>$value} syntax
|
- added {foreach $array as $key=>$value} syntax
|
||||||
|
- renamed extend tag and resource to extens: {extends file='foo.tol'} , $smarty->display('extends:foo.tpl|bar.tpl);
|
||||||
|
|
||||||
11/15/2009
|
11/15/2009
|
||||||
- lexer/parser optimizations on quoted strings
|
- lexer/parser optimizations on quoted strings
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Smarty Internal Plugin Compile extend
|
* Smarty Internal Plugin Compile extend
|
||||||
*
|
*
|
||||||
* Compiles the {extend} tag
|
* Compiles the {extends} tag
|
||||||
*
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage Compiler
|
* @subpackage Compiler
|
||||||
@@ -12,9 +12,9 @@
|
|||||||
/**
|
/**
|
||||||
* Smarty Internal Plugin Compile extend Class
|
* Smarty Internal Plugin Compile extend Class
|
||||||
*/
|
*/
|
||||||
class Smarty_Internal_Compile_Extend extends Smarty_Internal_CompileBase {
|
class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {
|
||||||
/**
|
/**
|
||||||
* Compiles code for the {extend} tag
|
* Compiles code for the {extends} tag
|
||||||
*
|
*
|
||||||
* @param array $args array with attributes from parser
|
* @param array $args array with attributes from parser
|
||||||
* @param object $compiler compiler object
|
* @param object $compiler compiler object
|
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty Internal Plugin Resource Extend
|
* Smarty Internal Plugin Resource Extends
|
||||||
*
|
*
|
||||||
* Implements the file system as resource for Smarty which does extend a chain of template files templates
|
* Implements the file system as resource for Smarty which does extend a chain of template files templates
|
||||||
*
|
*
|
||||||
@@ -10,9 +10,9 @@
|
|||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Smarty Internal Plugin Resource Extend
|
* Smarty Internal Plugin Resource Extends
|
||||||
*/
|
*/
|
||||||
class Smarty_Internal_Resource_Extend {
|
class Smarty_Internal_Resource_Extends {
|
||||||
public function __construct($smarty)
|
public function __construct($smarty)
|
||||||
{
|
{
|
||||||
$this->smarty = $smarty;
|
$this->smarty = $smarty;
|
Reference in New Issue
Block a user