d5e95f5a62c8c7324384619a6f68ff986fc9aea7
[lhc/web/wiklou.git] / Smarty-2.6.2 / RELEASE_NOTES
1 2.5.0
2 -----
3
4 Very minor adjustments since RC2, see the NEWS file for details.
5
6 2.5.0-RC2
7 ---------
8
9 Many fixes since the RC1 release. This one is as close to production quality as
10 they come, so this will be the last release before 2.5.0. The SGML documentation
11 files have also been removed from the tarball. If you want them, get them from
12 the CVS repository.
13
14 2.5.0-RC1
15 ---------
16
17 Release Candidate 1. All $smarty vars can now be dynamic, such as
18 $smarty.get.$foo. A new class function get_function_object() gets you a
19 reference to an assigned object, useful within your own custom functions.
20 append() can now merge as well as append with a third optional attribute. A new
21 class function get_config_vars() was added, and get_template_vars() can now be
22 used to get individual vars. Full variable syntax is now supported within
23 double quotes via a backtick (`) syntax. Files created by smarty are now
24 written to a tmp file then renamed to avoid file lock retention. html_radios,
25 html_checkboxes, html_table, html_image, nl2br functions added, see the NEWS
26 file for full details.
27
28 2.4.2
29 -----
30 Another point release. Added support for dynamic object reference syntax
31 ($foo->$bar), support for full variable syntax within quotes ("$foo[0].bar"),
32 and other minor fixes. See the NEWS file for full details.
33
34 2.4.1
35 -----
36
37 This is basically a point release, cleaning up a few things caught
38 in the 2.4.0 release. See the NEWS file for full details.
39
40 2.4.0
41 -----
42
43 Smarty now supports the ability to access objects within the templates. Two
44 methods are available, one which closely follows Smartys conventions, and
45 another that follows more traditional object syntax for those familiar with
46 PHP.
47
48 The internal compiling engine has also undergone some major work. The regex
49 parsing was rewritten to be much more strict, more secure and more
50 maintainable. Config files are now compiled, which can speed up pages quite a
51 bit that use config files extensively. Assigned variables are no longer
52 extracted to PHP namespace, saving an extract call for every template. There is
53 now support for applying modifiers to static values and functions. You can now
54 access constants with $smarty.const.VAR. See the NEWS file for complete
55 changes.
56
57 2.3.1
58 -----
59
60 The mtime on compiled files will now match the source files, in the case where
61 the source file may not get the current timestamp, recompiling will still work
62 as expected. Proper support for open_basedir has been added, so Smarty should
63 work correctly in safe mode. Added a few new features such as textformat block
64 function, strip variable modifier and optgroup support for html_options. Also
65 other minor bug fixes, see the Change Log.
66
67 2.3.0
68 -----
69
70 Smarty now has a {debug} template function that brings up the debugging console
71 right where {debug} is called, regardless of $debugging settings. This works a
72 little different than turning on $debugging in the sense that it shows all the
73 template variables available at the time {debug} is called, including local
74 scope vars. It does not show the templates names however, since this
75 executed during runtime of the template.
76
77 You can now supply an expire time when clearing cache or compile files. This is
78 mostly useful for removing stale files via the API.
79
80 Plugins now stop execution upon error, instead of outputting a warning and
81 continuing.
82
83 Two new API functions, assign_by_ref() and append_by_ref() were added. They
84 allow assigning template variables by reference. This can make a significant
85 performance gain, especially if you are assigning large arrays of data. PHP 5.0
86 will do this implicitly, so these functions are basically workarounds.
87
88 Several misc bug fixes, see the Change Log for information.
89
90
91 2.2.0
92 -----
93
94 Smarty now allows an array of paths for the $plugin_dir class variable. The
95 directories will be searched in the order they are given, so for efficiency keep
96 the most-used plugins at the top. Also, absolute paths to the plugin directories are
97 more efficient than relying on the PHP include_path.
98
99 Cache files can now be grouped with the cache_id. See the documentation under
100 the new "Caching" section for details. compile_id also respects the same
101 grouping syntax. The cache/compile file structure changed, so be sure to clear
102 out all your cache and compile files when upgrading Smarty. Also if you are
103 using PHP-accelerator, restart apache. I've seen some quirky things happen if
104 the phpa files do not get cleared (known issue with phpa and parent
105 class-member changes, so just clear 'em.)
106
107 Smarty now correctly respects the PHP include_path for $template_dir, $compile_dir,
108 $cache_dir, $config_dir and $plugin_dir. Be aware that relying on the
109 include_path is an overhead, try to use absolute pathnames when possible
110 (or relative to working directory.)
111
112 Documentation has been updated and rearranged a bit. Most notably, the
113 installation instructions are completely revamped, and a new Caching section
114 explains Smarty's caching in detail along with the new grouping functionality.
115
116 Many misc. bug fixes and enhancements, see the full ChangeLog (NEWS file) for
117 details.
118
119 2.1.1
120 -----
121
122 There was a bug with template paths and the include_path, this has been fixed.
123 Also register_outputfilter() did not work, this is fixed. A new template
124 function named "cycle" has been added to the distribution, nice for cycling
125 through a list (or array) of values.
126
127 2.1.0
128 -----
129
130 This release has quite a few new features and fixes. Most notable are the
131 introduction of block functions, so you can write plugins that work on a block
132 of text with {func}{/func} notation. Also output filters were added, so you can
133 apply a function against the output of your templates. This differs from the
134 postfilter function, which works on the compiled template at compile time, and
135 output filters work on the template output at runtime.
136
137 Many other features and bug fixes are noted in the NEWS file.
138
139
140 2.0.1
141 -----
142
143 This is a point release, fixing a few bugs and cleaning things up. A plugin
144 was renamed, the dash "-" was removed from compiled template and cached file
145 names. If you're upgrading, you might want to clear them out first. See the
146 ChangeLog for details.
147
148 2.0.0
149 -----
150
151 This release is a huge milestone for Smarty. Most notable new things are a
152 plugin architecture, removal of PEAR dependency, and optimizations that
153 drastically improve the performance of Smarty in most cases.
154
155 The plugin architecture allows modifiers, custom functions, compiler functions,
156 prefilters, postfilters, resources, and insert functions to be added by
157 simply dropping a file into the plugins directory. Once dropped in, they are
158 automatically registered by the template engine. This makes user-contributed
159 plugins easy to manage, as well as the internal workings of Smarty easy to
160 control and customize. This new architecture depends on the __FILE__ constant,
161 which contains the full path to the executing script. Some older versions of
162 PHP incorrectly gave the script name and not the full filesystem path. Be sure
163 your version of PHP populates __FILE__ correctly. If you use custom template
164 resource functions, the format of these changed with the plugin architecture.
165 Be sure to update your functions accordingly. See the template resource section
166 of the documentation.
167
168 The PEAR dependancy was removed from Smarty. The Config_File class that comes
169 with Smarty was actually what needed PEAR for error handling which Smarty didn't
170 use, but now everything is self-contained.
171
172 Performance improvements are graphed on the benchmark page, you will see that
173 overall performance has been sped up by as much as 80% in some cases.
174
175 Smarty-cached pages now support If-Modified-Since headers, meaning that if a
176 cached template page has not changed since the last request, a "304 Not
177 Modified" header will be sent instead of resending the same page. This is
178 disabled by default, change the setting of $cache_modified_check.
179
180
181 1.5.2
182 -----
183
184 Mostly bug fixes, added a default template resource handler.
185
186
187 1.5.1
188 -----
189
190 Critical bug fix release. If you use caching, you'll need to upgrade.
191
192
193 1.5.0
194 -----
195
196 Several feature enhancements were made to this version, most notably the
197 {foreach ...} command which is an alternative to {section ...} with an easier
198 syntax for looping through a single array of values. Several functions were
199 enhanced so that the output can be automatically assigned to a template
200 variable instead of displayed (assign attribute). Cache files can now be
201 controlled with a custom function as an alternative to the built-in file based
202 method. Many code cleanups and bug fixed went into this release as well.
203
204
205 1.4.6
206 -----
207
208 The behavior with caching and compile_check has been slightly enhanced. If
209 caching is enabled AND compile_check is enabled, the cache will immediately get
210 regenerated if _any_ involved template or config file is updated. This imposes
211 a slight performance hit because it must check all the files for changes, so be
212 sure to run live sites with caching enabled and compile_check disabled for best
213 performance. If you update a template or config file, simply turn on
214 compile_check, load the page, then turn it back off. This will update the cache
215 file with the new content. This is accomplished by maintaining a list of
216 included/loaded templates and config files at the beginning of the cache file.
217 Therefore it is advisable to remove all cache files after upgrading to 1.4.6
218 (although not absolutely necessary, old cache files will regenerate)
219
220 The debug console now has script timing and array values printed. You MUST
221 update your debug.tpl file with this version of Smarty. Also, the new debug.tpl
222 will not work with older versions of Smarty.
223
224
225 1.4.5
226 -----
227
228 Mostly bug fixes and minor improvements. Added compile id for separate compiled
229 versions of the same script. The directory format and filename convention for
230 the files in templates_c has changed, so you may want to remove all of the
231 existing ones before you upgrade.
232
233
234 1.4.4
235 -----
236
237 A few bug fixes, new section looping attributes and properties, debugging
238 console function for control via URL, and overLib integration and access
239 to request variables from within the template.
240
241
242 1.4.3
243 -----
244
245 This release has a few bug fixes and several enhancements. Smarty now supports
246 template security for third-party template editing. These features disallow the
247 ability for someone to execute commands or PHP code from the template language.
248 Smarty also now has a built-in debugging console, which is a javascript pop-up
249 window that displays all the included template names and assigned variables.
250
251
252 1.4.2
253 -----
254
255 This was mostly one bug fix with variable scoping within included templates
256 and a few documentation changes and updates. See the ChangeLog file for full
257 details.
258
259
260 1.4.1
261 -----
262
263 It seems that the EX_LOCK logic from the previous release didn't fix all the
264 problems with windows platforms. Hopefully this one does. It basically
265 disables file locking on windows, so there is a potential that two programs
266 could write over the same file at the same time, fyi.
267
268 The reset is minor bug fixes, please refer to the ChangeLog file.
269
270
271 1.4.0
272 -----
273
274 IMPORTANT NOTICE
275
276 Smarty now has a new syntax for accessing elements within section loops. The
277 new syntax is easier to use and nicely handles data structures of any
278 complexity. Consequently, this breaks the old syntax.
279
280 Here is an example of the syntax change:
281
282 old syntax:
283 {$sec1/sec2/sec3/customer.phone}
284
285 new syntax:
286 {$customer[$sec1][$sec2][$sec3].phone}
287
288 The section names used to come first, followed by the variable name. Now the
289 variable name always comes first, followed by the section names in brackets.
290 You can access variable indexes anywhere, depending on how you passed the
291 variables in.
292
293 To fix your current templates, we have provided a script that will adjust the
294 syntax for you. Located in misc/fix_vars.php, run this script from the the
295 command line, giving each template as an argument. Be sure to use absolute
296 pathnames, or pathnames relative to the executing script. Probably the easiest
297 way to do this is to copy the fix_vars.php script into your template directory
298 and run 'php -q fix_vars.php *.tpl' Be sure you have proper write permission,
299 and backup your scripts first to be safe! The examples in the 1.4.0
300 documentation have been updated to reflect the changes.
301
302 cd /path/to/templates
303 cp /path/to/fix_vars.php .
304 find . -name "*.tpl" -exec php -q ./fix_vars.php {} \;
305
306 NEW AND IMPROVED COMPILATION PROCESS
307
308 Smarty 1.4.0 also has a new compilation process. Instead of compiling all the
309 templates up front, it now compiles them at runtime. This has several
310 advantages. First of all, there is no longer a need to have a single template
311 directory. You can now have arbitrary template sources, such as multiple
312 directories or even database calls. This also speeds the performance of Smarty
313 when $compile_check is enabled, since it is only checking the template that is
314 being executed instead of everything found in the template directory. The
315 $tpl_file_ext is no longer needed, but kept for backward compatability.
316 Templates can now be named anything you like with any extension.
317
318 MINOR FIXES
319
320 A workaround for LOCK_EX on Windows systems was added, and changed a couple of
321 file permissions for better security on public servers.
322
323 $show_info_header is now defaulted to false instead of true. This header causes
324 problems when displaying content other than HTML, so now you must explicitly
325 set this flag to true to show the header information (or change the default in
326 your copy of Smarty.)
327
328 Documentation is written in docbook format. I updated the docbook -> HTML
329 generating software & style-sheets, and consequently the examples are no longer
330 in a different background color. If anyone wants to contribute a better
331 stylesheet or help with documentation, drop me a line. <monte@ispi.net>
332
333 CHANGES/ENHANCEMENTS/UPDATES
334
335 date_format, html_select_date and html_select_time used to require a unix
336 timestamp as the format of the date passed into the template. Smarty is now a
337 bit smarter at this. It will take a unix timestamp, a mysql timestamp, or any
338 date string that is parsable by strtotime, such as 10/01/2001 or 2001-10-01,
339 etc. Just give some formats a try and see what works.
340
341 Smarty now has template prefilters, meaning that you can run your templates
342 through custom functions before they are compiled. This is good for things like
343 removing unwanted comments, keeping an eye on words or functionality people are
344 putting in templates, translating XML -> HTML, etc. See the register_prefilter
345 documentation for more info.
346
347 Another addition are the so-called compiler functions. These are custom
348 functions registered by the user that are executed at compilation time of the
349 template. They can be used to inject PHP code or time-sensitive static content
350 into the compiled template.
351
352 The run-time custom functions are now passed the Smarty object as the second
353 parameter. This can be used, for example, to assign or clear template variables
354 from inside the custom function.
355
356 clear_compile_dir() was added for clearing out compiled versions of your
357 templates. Not something normally needed, but you may have a need for this if
358 you have $compile_check set to false and you periodically update templates via
359 some automated process. As of 1.4.0, uncompiled templates _always_ get
360 compiled regardless of $compile_check setting, although they won't be checked
361 for recompile if $compile_check is set to false.
362
363 You can now refer to properties of objects assigned from PHP by using the '->'
364 symbol and specifying the property name after it, e.g. $foo->bar.
365
366 {php}{/php} tags were added to embed php into the templates. Not normally
367 needed, but some circumstances may call for it. Check out the "componentized
368 templates" tip in the documentation for an example.
369
370 {capture}{/capture} and {counter} functions were added. See the documentation
371 for a complete description and examples.
372
373 UPGRADE NOTES
374
375 The format of the files created in the $compile_dir are now a bit different.
376 The compiled template filename is the template resource name url-encoded.
377 Therefore, all compiled files are now in the top directory of $compile_dir.
378 This was done to make way for arbitrary template resources. Each compiled
379 template also has a header that states what template resource was used to
380 create it. From a unix command prompt, you can use "head -2 *" to see the first
381 two lines of each file.
382
383 When upgrading to 1.4.0, you will want to clear out all your old files in the
384 $compile_dir. If you have $compile_check set to false and the compiled template
385 does not yet exist, it will compile it regardless of this setting. This way you
386 can clear out the $compile_dir and not worry about setting $compile_check to
387 true to get the inital compilation under way.
388
389
390 1.3.2
391 -----
392
393 Smarty now has (an optional) header prepended to the output of the Smarty
394 templates. This displays the Smarty version and the date/time when the page was
395 generated. This is useful for debugging your cache routines, and purely
396 informational so there is evidence that the page was generated by Smarty. Set
397 $show_info_header to false to disable it.
398
399 {config_load ...} performance was tuned by placing the loaded variables into a
400 global array, so basically a config file is read from the file system and
401 placed into a php array structure only once, no matter how many times it is
402 called in any of the templates. The scope of the loaded variables has changed a
403 bit as well. Variables loaded by config_load used to be treated as global
404 variables, meaning that parent templates (templates that included the current
405 template) could see them. Now the default behavior is such that loaded
406 variables are only visible by the current template and child templates (all
407 templates included after the {config_load ...} is called.) To mimic the
408 original behavior, provide the attribute "global=yes" like so: {config_load
409 file="mystuff.conf" global=yes}. Now when you load in mystuff.conf, the
410 variables will be visible to parent templates (merged with any existing config
411 variables.)
412
413 A formatting attribute was added to the {math ...} function, adding the ability
414 to control the format of the output. Use the same formatting syntax as the PHP
415 function sprintf().
416
417 {html_select_time ...} was added, a custom function that works much like
418 {html_select_date ...} except it displays time elements instead of dates.
419
420 A few custom modifiers were added: count_characters, count_words,
421 count_sentences, count_paragraphs. All pretty self-explanatory.
422
423 /* vim: set et: */