"Fossies" - the Fresh Open Source Software Archive 
Member "serendipity/bundled-libs/Smarty/NEW_FEATURES.txt" (20 Nov 2022, 13793 Bytes) of package /linux/www/serendipity-2.4.0.zip:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the latest
Fossies "Diffs" side-by-side code changes report for "NEW_FEATURES.txt":
2.3.5_vs_2.4.0.
1
2
3 This file contains a brief description of new features which have been added to Smarty 3.1
4
5 Smarty 3.1.33-dev
6 Variable capture name in Smarty special variable
7 ================================================
8 {$smarty.capture.$foo} can now be used to access the content of a named
9 capture block
10
11 Smarty 3.1.32
12 New tags for inheritance parent and child
13 =========================================
14 {parent} == {$smarty.block.parent}
15 {child} == {$smarty.block.child}
16 Both tags support the assign attribute like
17 {child assign=foo}
18
19 Deprecate functions Smarty::muteExpectedErrors() and Smarty::unmuteExpectedErrors()
20 ===================================================================================
21 These functions to start a special error handler are no longer needed as Smarty does
22 no longer use error suppression like @filemtime().
23 For backward compatibility the functions still can be called.
24
25 Using literals containing Smarty's left and right delimiter
26 ===========================================================
27 New Methods
28 $smarty->setLiterals(array $literals)
29 $smarty->addLiterals(array $literals)
30 to define literals containing Smarty delimiter. This can avoid the need for extreme usage
31 of {literal} {/literal} tags.
32 A) Treat '{{' and '}}' as literal
33 If Smarty::$auto_literal is enabled
34 {{ foo }}
35 will be treated now as literal. (This does apply for any number of delimiter repeatations).
36 However {{foo}} is not an literal but will be interpreted as a recursive Smarty tag.
37 If you use
38 $smarty->setLiterals(array('{{','}}'));
39 {{foo}} is now a literal as well.
40 NOTE: In the last example nested Smarty tags starting with '{{' or ending with '}}' will not
41 work any longer, but this should be very very raw occouring restriction.
42 B) Example 2
43 Assume your delimiter are '<-' , '->' and '<--' , '-->' shall be literals
44 $smarty->setLiterals(array('<--','-->'));
45
46
47 The capture buffers can now be accessed as array
48 ================================================
49 {capture name='foo'}
50 bah
51 {\capture}
52 {capture name='buh'}
53 blar
54 {\capture}
55 {foreach $smarty.capture as $name => $buffer}
56 ....
57 {/foreach}
58
59 Smarty 3.1.31
60 New tags for inheritance parent and child
61 =========================================
62 {block_parent} == {$smarty.block.parent}
63 {block_child} == {$smarty.block.child}
64
65 Smarty 3.1.30
66
67 Loop optimization {foreach} and {section}
68 =========================================
69 Smarty does optimize the {foreach} and {section} loops by removing code for not needed loop
70 properties.
71 The compiler collects needed properties by scanning the current template for $item@property,
72 $smarty.foreach.name.property and $smarty.section.name.property.
73 The compiler does not know if additional properties will be needed outside the current template scope.
74 Additional properties can be generated by adding them with the property attribute.
75
76 Example:
77 index.tpl
78 {foreach $from as $item properties=[iteration, index]}
79 {include 'sub.tpl'}
80 {$item.total}
81 {/foreach}
82
83 sub.tpl
84 {$item.index} {$item.iteration} {$item.total}
85
86 In above example code for the 'total' property is automatically generated as $item.total is used in
87 index.tpl. Code for 'iteration' and 'index' must be added with properties=[iteration, index].
88
89 New tag {make_nocache}
90 ======================
91 Syntax: {make_nocache $foo}
92
93 This tag makes a variable which does exists normally only while rendering the compiled template
94 available in the cached template for use in not cached expressions.
95
96 Expample:
97 {foreach from=$list item=item}
98 <li>{$item.name} {make_nocache $item}{if $current==$item.id} ACTIVE{/if}</li>
99 {/foreach}
100
101 The {foreach} loop is rendered while processing the compiled template, but $current is a nocache
102 variable. Normally the {if $current==$item.id} would fail as the $item variable is unknown in the cached template. {make_nocache $item} does make the current $item value known in thee cached template.
103
104 {make_nocache} is ignored when caching is disabled or the variable does exists as nocache variable.
105
106 NOTE: if the variable value does contain objects these must have the __set_state method implemented.
107
108
109 Scope Attributes
110 ================
111 The scope handling has been updated to cover all cases of variable assignments in templates.
112
113 The tags {assign}, {append} direct assignments like {$foo = ...}, {$foo[...]= ...} support
114 the following optional scope attributes:
115 scope='parent' - the variable will be assigned in the current template and if the template
116 was included by {include} the calling template
117 scope='tpl_root' - the variable will be assigned in the outermost root template called by $smarty->display()
118 or $smarty->fetch() and is bubbled up all {include} sub-templates to the current template.
119 scope='smarty' - the variable will be assigned in the Smarty object and is bubbled up all {include} sub-templates
120 to the current template.
121 scope='global' - the variable will be assigned as Smarty object global variable and is bubbled up all {include}
122 sub-templates to the current template.
123 scope='root' - the variable will be assigned if a data object was used for variable definitions in the data
124 object or in the Smarty object otherwise and is bubbled up all {include} sub-templates to the
125 current template.
126 scope='local' - this scope has only a meaning if the tag is called within a template {function}.
127 The variable will be assigned in the local scope of the template function and the
128 template which did call the template function.
129
130
131 The {config_load} tag supports all of the above except the global scope.
132
133 The scope attribute can be used also with the {include} tag.
134 Supported scope are parent, tpl_root, smarty, global and root.
135 A scope used together with the {include} tag will cause that with some exceptions any variable
136 assignment within that sub-template will update/assign the variable in other scopes according
137 to the above rules. It does include also variables assigned by plugins, tags supporting the assign=foo attribute and direct assignments in {if} and {while} like {if $foo=$bar}.
138 Excluded are the key and value variables of {foreach}, {for} loop variables , variables passed by attributes
139 in {include} and direct increments/decrements like {$foo++}, {$foo--}
140
141 Note: The scopes should be used only to the extend really need. If a variable value assigned in an included
142 sub-template should be returned to the calling sub-template just use {$foo='bar' scope='parent'}.
143 Use scopes only with variables for which it's realy needed. Avoid general scope settings with the
144 {include} tag as it can have a performance impact.
145
146 The {assign}, {append}, {config_load} and {$foo...=...} tags have a new option flag 'noscope'.Thi
147 Example: {$foo='bar' noscope} This will assign $foo only in the current template and any scope settings
148 at {include} is ignored.
149
150
151 Caching
152 =======
153 Caching does now observe the template_dir setting and will create separate cache files if required
154
155 Compiled Templates
156 ==================
157 The template_dir setting is now encoded in the uid of the file name.
158 The content of the compiled template may depend on the template_dir search order
159 {include .... inline} is used or $smarty->merge_compiled_includes is enabled
160
161 APC
162 ===
163 If APC is enabled force an apc_compile_file() when compiled or cached template was updated
164
165 Smarty 3.1.28
166
167 OPCACHE
168 =======
169 Smarty does now invalidate automatically updated and cleared compiled or cached template files in OPCACHE.
170 Correct operation is no longer dependent on OPCACHE configuration settings.
171
172 Template inheritance
173 ====================
174 Template inheritance is now processed in run time.
175 See the INHERITANCE_RELEASE_NOTES
176
177 Modifier regex_replace
178 ======================
179 An optional limit parameter was added
180
181 fetch() and display()
182 =====================
183 The fetch() and display() methods of the template object accept now optionally the same parameter
184 as the corresponding Smarty methods to get the content of another template.
185 Example:
186 $template->display(); Does display template of template object
187 $template->display('foo.tpl'); Does display template 'foo.bar'
188
189 File: resource
190 ==============
191 Multiple template_dir entries can now be selected by a comma separated list of indices.
192 The template_dir array is searched in the order of the indices. (Could be used to change the default search order)
193 Example:
194 $smarty->display('[1],[0]foo.bar');
195
196 Filter support
197 ==============
198 Optional filter names
199 An optional filter name was added to $smarty->registerFilter(). It can be used to unregister a filter by name.
200 - $smarty->registerFilter('output', $callback, 'name');
201 $smarty->unregister('output', 'name');
202
203 Closures
204 $smarty->registerFilter() does now accept closures.
205 - $smarty->registerFilter('pre', function($source) {return $source;});
206 If no optional filter name was specified it gets the default name 'closure'.
207 If you register multiple closures register each with a unique filter name.
208 - $smarty->registerFilter('pre', function($source) {return $source;}, 'closure_1');
209 - $smarty->registerFilter('pre', function($source) {return $source;}, 'closure_2');
210
211
212 Smarty 3.1.22
213
214 Namespace support within templates
215 ==================================
216 Within templates you can now use namespace specifications on:
217 - Constants like foo\bar\FOO
218 - Class names like foo\bar\Baz::FOO, foo\bar\Baz::$foo, foo\bar\Baz::foo()
219 - PHP function names like foo\bar\baz()
220
221 Security
222 ========
223 - disable special $smarty variable -
224 The Smarty_Security class has the new property $disabled_special_smarty_vars.
225 It's an array which can be loaded with the $smarty special variable names like
226 'template_object', 'template', 'current_dir' and others which will be disabled.
227 Note: That this security check is performed at compile time.
228
229 - limit template nesting -
230 Property $max_template_nesting of Smarty_Security does set the maximum template nesting level.
231 The main template is level 1. The nesting level is checked at run time. When the maximum will be exceeded
232 an Exception will be thrown. The default setting is 0 which does disable this check.
233
234 - trusted static methods -
235 The Smarty_Security class has the new property $trusted_static_methods to restrict access to static methods.
236 It's an nested array of trusted class and method names.
237 Format:
238 array (
239 'class_1' => array('method_1', 'method_2'), // allowed methods
240 'class_2' => array(), // all methods of class allowed
241 )
242 To disable access for all methods of all classes set $trusted_static_methods = null;
243 The default value is an empty array() which does enables all methods of all classes, but for backward compatibility
244 the setting of $static_classes will be checked.
245 Note: That this security check is performed at compile time.
246
247 - trusted static properties -
248 The Smarty_Security class has the new property $trusted_static_properties to restrict access to static properties.
249 It's an nested array of trusted class and property names.
250 Format:
251 array (
252 'class_1' => array('prop_1', 'prop_2'), // allowed properties listed
253 'class_2' => array(), // all properties of class allowed
254 }
255 To disable access for all properties of all classes set $trusted_static_properties = null;
256 The default value is an empty array() which does enables all properties of all classes, but for backward compatibility
257 the setting of $static_classes will be checked.
258 Note: That this security check is performed at compile time.
259
260 - trusted constants .
261 The Smarty_Security class has the new property $trusted_constants to restrict access to constants.
262 It's an array of trusted constant names.
263 Format:
264 array (
265 'SMARTY_DIR' , // allowed constant
266 }
267 If the array is empty (default) the usage of constants can be controlled with the
268 Smarty_Security::$allow_constants property (default true)
269
270
271
272 Compiled Templates
273 ==================
274 Smarty does now automatically detects a change of the $merge_compiled_includes and $escape_html
275 property and creates different compiled templates files depending on the setting.
276
277 Same applies to config files and the $config_overwrite, $config_booleanize and
278 $config_read_hidden properties.
279
280 Debugging
281 =========
282 The layout of the debug window has been changed for better readability
283
284 New class constants
285 Smarty::DEBUG_OFF
286 Smarty::DEBUG_ON
287 Smarty::DEBUG_INDIVIDUAL
288 have been introduced for setting the $debugging property.
289
290 Smarty::DEBUG_INDIVIDUAL will create for each display() and fetch() call an individual debug window.
291