smarty template engine
Friday, July 25, 2008  
download | documentation | faq | forum | mailing lists | changelog | contribs 


search for in the  


Smarty 2.6.0 - Release Notes

In development and testing for over 7 months, Smarty 2.6.0 is now available!
This release incorporates numerous enhancements, refinements, bug-fixes, speed-ups and architectural changes that will benefit developers, designers and deployers. Compatibility with supported functionality of previous releases has been a specific focus allowing most existing installations to upgrade with minimal changes required and typically, none at all.
The 2.6.0 release also marks a maturation of the Smarty codebase, source code and documentation. With improved error handling, enhanced diagnostic capabilities, better multi-platform support and numerous bug-fixes, many testers have noted that 2.6.0 is more stable and easier to debug than previous versions. Some adopters are already using pre-release versions of 2.6.0 on production sites.
Source code improvements include improved organization and better annotation including tagging support for PHP Documentor. Incremental improvements were also achieved in the accompanying documentation, now available in English, German and a new French translation.

General

Important changes have been made to the underlying Smarty architecture. Notable is the introduction of core/, a new, required directory containing specialized and specific functionality previously bundled directly in the Smarty class. This abstraction has allowed for a reduction in the base smarty class footprint while fostering reuse of several common functions. These changes also lay the groundwork for future modularizations of the code base.
Note to upgraders:
  • All Smarty code is now contained in the libs/ directory hierarchy of the distribution.
  • Remember to clear out the compiled and cached files anytime you update Smarty.
  • It is recommended to also clear your accelerator cache and restart Apache.
  • The following is of note to deployers, developers and those working directly with the base Smarty source code.
    • NEW all in-code doc comments converted to phpDocumentor format (Greg)
    • NEW abstract many core components from Smarty.class.php, speeding up core class instantiation (Monte)
    • NEW speed up compiled templates, hardcode plugin filepaths instead of dynamically calculate at runtime. (Monte)
    • NEW default_resource_type feature (Monte)
    • NEW config-option "request_use_auto_globals" to make auto-globals be used as request vars instead of HTTP_*_VARS (messju)
    • CNG ignore one char resource names like c:foo.tpl (Monte)
    • CNG remove import of of attributes of {include_php} to php's namespace. use $params[name] instead (messju)
    • CNG use DIRECTORY_SEPARATOR exclusively, keep DIR_SEP for BC (Monte)
    • CNG move Smarty::quote_replace() to Smarty_Compiler::_quote_replace() (messju)
    • CNG remove Smarty::_plugin_implementation_exists() - use is_callable() (messju)
    • FIX add discrete error checking pertaining to $cache_dir and $compile_dir, their existance and writability (Monte)
    • FIX bug with passing $smarty as reference in Smarty.compiler.class (messju)
    • FIX apply modifiers only once to section-loop and foreach-from attrs (messju)
    • FIX bug in traversal of $smarty->plugins_dir-array. now the first matching plugin is taken (messju)
    • FIX bug in _create_dir_structure() when used with open_basedir-restriction and relative paths (messju)
    • FIX handling of trailing-slashes in open_basedir in smarty_core_create_dir_structure() (packman, messju)
    • FIX escapement of special chars for key vals in debug console (Monte)

    Output Handling

    Some changes affect the way output is produced by Smarty and should be noted by both designers and developers.
    • FIX status-header for cache_modified_check under cgi-sapi (messju)
    • FIX newlines for tags without template output (Monte)
    • FIX output corrected with {strip} and PHP tag newlines (Monte)
    • FIX remove unnecessary close/open tags from compiled templates (Monte)
    • FIX removal of leading/trailing newlines in {strip}-blocks (messju)

    Template Language Enhancements

    In-Template Math Support: Of note to template designers is the introduction of native math support within templates. In many cases this eliminates the need to use the more complicated and much slower math plugin. Virtually all math operations possible in PHP are now possible within templates with the caveat that spaces are not allowed within math expressions.
    • NEW allow spaces in literal tags (Paul Lockaby, Monte)
    • NEW hex-constants (0x...) as function-attributes, inside if-statements and as modifier-parameters (messju)
    • NEW hex-constants in function.math.php (messju)
    • NEW in-template math (Dominik, Monte, messju)
    • NEW optional assign-attribute to {capture}-tag (messju)
    • NEW params vdir, hdir and inner to html_table to allow looping over the data in various directions (messju)
    • NEW added <labels> to html_checkboxes and html_radios (Philippe, messju)
    • NEW "labels"-options to turn off labels in html_checkboxes and _radios (messju)
    • CNG handle $var.key inside [] (messju)
    • CNG ignore {strip}/{/strip) inside {strip}-blocks (messju)
    • CNG html_image always renders an alt-tag now (default alt="") (messju)
    • CNG changed "link" to "href" in html_image. "link" is still working but deprecated (messju)
    • FIX assign attribute for multiple counters (messju)
    • FIX errornous creation of '//' in image_path in html_image (messju)
    • FIX behaviour of start=... for {counter} (messju)
    • FIX assign for {counter} (messju)
    • FIX handling of assign inside {insert}-tags (messju)
    • FIX proper escaping of " and ' with escape:javascript (messju)

    Configuration File Handling

    • NEW speed up config_load, simplify compiling (Monte)
    • CNG moved config_load from smarty core to plugin (Monte)
    • FIX config_load: handling of section-attribute and use of multiple config-files in one template (atu, messju)
    • FIX handling if [...] inside triple-quotes in config-files (messju)
    • FIX bug where config file starts with hidden section (boots, Monte)
    • FIX debug timing logic for config_load (Tom Sommer, Monte)

    Improved Plugin and API Functionality

    The programmer API and plugin interface has been enhanced in several notable ways.
    Non-Caching Plugins: plugins can now be registered as non-cacheable.
    Object and Class Callbacks: Now all registerable plugin functionality provides support for object and class callbacks in addition to the previously available function callbacks. This support also extends to the default_template_handler function, compiler_function and cache_handler_func callbacks.
    Block Functions: The block function api interface has been extended to support an additional parameter, "repeat", which enables the development of generic custom iterators.
    Block Methods: Object registration has been enhanced to allow methods of registered objects to be declared as block functions instead of standard template functions.
    • NEW optional parameter $cache_attrs to register_function() and register_block(). $cache_attrs is an array containing attribute-names that should be cached on calls to functions that have $cacheable set to false. (messju)
    • NEW $cacheable-parameter to register_compiler_function() (messju)
    • NEW $cacheable-parameter with default=true to register_function() and register_block() (messju)
    • NEW registration of object and class-methods as callbacks for the register_*- functions and $cache_handler_func, $default_template_handler_func (messju)
    • NEW array(&$obj. 'source', 'timestamp', 'secure', 'trusted') as callback for register_resource() (messju);
    • NEW block-methods for registered objects (Bharat Mediratta, messju)
    • CNG added &$repeat-parameter to block-functions (messju)



     

    credits 

    Smarty Copyright © 2002-2008
    New Digital Group, Inc.

    All rights reserved.