📄 release_notes
字号:
performance. If you update a template or config file, simply turn oncompile_check, load the page, then turn it back off. This will update the cachefile with the new content. This is accomplished by maintaining a list ofincluded/loaded templates and config files at the beginning of the cache file.Therefore it is advisable to remove all cache files after upgrading to 1.4.6(although not absolutely necessary, old cache files will regenerate)The debug console now has script timing and array values printed. You MUSTupdate your debug.tpl file with this version of Smarty. Also, the new debug.tplwill not work with older versions of Smarty.1.4.5-----Mostly bug fixes and minor improvements. Added compile id for separate compiledversions of the same script. The directory format and filename convention forthe files in templates_c has changed, so you may want to remove all of theexisting ones before you upgrade.1.4.4-----A few bug fixes, new section looping attributes and properties, debuggingconsole function for control via URL, and overLib integration and accessto request variables from within the template.1.4.3-----This release has a few bug fixes and several enhancements. Smarty now supportstemplate security for third-party template editing. These features disallow theability for someone to execute commands or PHP code from the template language.Smarty also now has a built-in debugging console, which is a javascript pop-upwindow that displays all the included template names and assigned variables.1.4.2-----This was mostly one bug fix with variable scoping within included templatesand a few documentation changes and updates. See the ChangeLog file for fulldetails.1.4.1-----It seems that the EX_LOCK logic from the previous release didn't fix all theproblems with windows platforms. Hopefully this one does. It basicallydisables file locking on windows, so there is a potential that two programscould write over the same file at the same time, fyi.The reset is minor bug fixes, please refer to the ChangeLog file.1.4.0-----IMPORTANT NOTICESmarty now has a new syntax for accessing elements within section loops. Thenew syntax is easier to use and nicely handles data structures of anycomplexity. Consequently, this breaks the old syntax.Here is an example of the syntax change:old syntax:{$sec1/sec2/sec3/customer.phone}new syntax:{$customer[$sec1][$sec2][$sec3].phone}The section names used to come first, followed by the variable name. Now thevariable name always comes first, followed by the section names in brackets.You can access variable indexes anywhere, depending on how you passed thevariables in.To fix your current templates, we have provided a script that will adjust thesyntax for you. Located in misc/fix_vars.php, run this script from the thecommand line, giving each template as an argument. Be sure to use absolutepathnames, or pathnames relative to the executing script. Probably the easiestway to do this is to copy the fix_vars.php script into your template directoryand run 'php -q fix_vars.php *.tpl' Be sure you have proper write permission,and backup your scripts first to be safe! The examples in the 1.4.0documentation have been updated to reflect the changes.cd /path/to/templatescp /path/to/fix_vars.php .find . -name "*.tpl" -exec php -q ./fix_vars.php {} \;NEW AND IMPROVED COMPILATION PROCESSSmarty 1.4.0 also has a new compilation process. Instead of compiling all thetemplates up front, it now compiles them at runtime. This has severaladvantages. First of all, there is no longer a need to have a single templatedirectory. You can now have arbitrary template sources, such as multipledirectories or even database calls. This also speeds the performance of Smartywhen $compile_check is enabled, since it is only checking the template that isbeing executed instead of everything found in the template directory. The$tpl_file_ext is no longer needed, but kept for backward compatability.Templates can now be named anything you like with any extension.MINOR FIXESA workaround for LOCK_EX on Windows systems was added, and changed a couple offile permissions for better security on public servers.$show_info_header is now defaulted to false instead of true. This header causesproblems when displaying content other than HTML, so now you must explicitlyset this flag to true to show the header information (or change the default inyour copy of Smarty.)Documentation is written in docbook format. I updated the docbook -> HTMLgenerating software & style-sheets, and consequently the examples are no longerin a different background color. If anyone wants to contribute a betterstylesheet or help with documentation, drop me a line. <monte@ispi.net>CHANGES/ENHANCEMENTS/UPDATESdate_format, html_select_date and html_select_time used to require a unixtimestamp as the format of the date passed into the template. Smarty is now abit smarter at this. It will take a unix timestamp, a mysql timestamp, or anydate string that is parsable by strtotime, such as 10/01/2001 or 2001-10-01,etc. Just give some formats a try and see what works.Smarty now has template prefilters, meaning that you can run your templatesthrough custom functions before they are compiled. This is good for things likeremoving unwanted comments, keeping an eye on words or functionality people areputting in templates, translating XML -> HTML, etc. See the register_prefilterdocumentation for more info.Another addition are the so-called compiler functions. These are customfunctions registered by the user that are executed at compilation time of thetemplate. They can be used to inject PHP code or time-sensitive static contentinto the compiled template.The run-time custom functions are now passed the Smarty object as the secondparameter. This can be used, for example, to assign or clear template variablesfrom inside the custom function.clear_compile_dir() was added for clearing out compiled versions of yourtemplates. Not something normally needed, but you may have a need for this ifyou have $compile_check set to false and you periodically update templates viasome automated process. As of 1.4.0, uncompiled templates _always_ getcompiled regardless of $compile_check setting, although they won't be checkedfor recompile if $compile_check is set to false.You can now refer to properties of objects assigned from PHP by using the '->'symbol and specifying the property name after it, e.g. $foo->bar.{php}{/php} tags were added to embed php into the templates. Not normallyneeded, but some circumstances may call for it. Check out the "componentizedtemplates" tip in the documentation for an example.{capture}{/capture} and {counter} functions were added. See the documentationfor a complete description and examples.UPGRADE NOTESThe format of the files created in the $compile_dir are now a bit different.The compiled template filename is the template resource name url-encoded.Therefore, all compiled files are now in the top directory of $compile_dir.This was done to make way for arbitrary template resources. Each compiledtemplate also has a header that states what template resource was used tocreate it. From a unix command prompt, you can use "head -2 *" to see the firsttwo lines of each file.When upgrading to 1.4.0, you will want to clear out all your old files in the$compile_dir. If you have $compile_check set to false and the compiled templatedoes not yet exist, it will compile it regardless of this setting. This way youcan clear out the $compile_dir and not worry about setting $compile_check totrue to get the inital compilation under way.1.3.2-----Smarty now has (an optional) header prepended to the output of the Smartytemplates. This displays the Smarty version and the date/time when the page wasgenerated. This is useful for debugging your cache routines, and purelyinformational so there is evidence that the page was generated by Smarty. Set$show_info_header to false to disable it.{config_load ...} performance was tuned by placing the loaded variables into aglobal array, so basically a config file is read from the file system andplaced into a php array structure only once, no matter how many times it iscalled in any of the templates. The scope of the loaded variables has changed abit as well. Variables loaded by config_load used to be treated as globalvariables, meaning that parent templates (templates that included the currenttemplate) could see them. Now the default behavior is such that loadedvariables are only visible by the current template and child templates (alltemplates included after the {config_load ...} is called.) To mimic theoriginal behavior, provide the attribute "global=yes" like so: {config_loadfile="mystuff.conf" global=yes}. Now when you load in mystuff.conf, thevariables will be visible to parent templates (merged with any existing configvariables.)A formatting attribute was added to the {math ...} function, adding the abilityto control the format of the output. Use the same formatting syntax as the PHPfunction sprintf().{html_select_time ...} was added, a custom function that works much like{html_select_date ...} except it displays time elements instead of dates.A few custom modifiers were added: count_characters, count_words,count_sentences, count_paragraphs. All pretty self-explanatory./* vim: set et: */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -