From c8e22351c8cf7d65541c77e2944dd56971666fd4 Mon Sep 17 00:00:00 2001 From: mohrt Date: Wed, 7 Aug 2002 14:57:34 +0000 Subject: [PATCH] update files with new version numbers --- Config_File.class.php | 2 +- NEWS | 3 + README | 2 +- RELEASE_NOTES | 24 +++++++ Smarty.class.php | 4 +- Smarty_Compiler.class.php | 2 +- docs/appendixes.sgml | 9 +-- docs/designers.sgml | 120 ++++++++++++++++++++++----------- docs/programmers.sgml | 87 ++++++++++++++++++++++-- libs/Config_File.class.php | 2 +- libs/Smarty.class.php | 4 +- libs/Smarty_Compiler.class.php | 2 +- 12 files changed, 204 insertions(+), 57 deletions(-) diff --git a/Config_File.class.php b/Config_File.class.php index 2212f5d5..bfe0e778 100644 --- a/Config_File.class.php +++ b/Config_File.class.php @@ -3,7 +3,7 @@ /** * Config_File class. * - * @version 2.2.0 + * @version 2.3.0 * @author Andrei Zmievski * @access public * diff --git a/NEWS b/NEWS index 255ac782..e65bfc74 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +Version 2.3.0 +------------- + - added assign_by_ref() and append_by_ref() functions (Bob Silva, Monte) - changed default warning type for plugin errors from diff --git a/README b/README index e5c89b05..bc6c9253 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ NAME: Smarty - the PHP compiling template engine -VERSION: 2.2.0 +VERSION: 2.3.0 AUTHORS: diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 4bfb846e..90720ee6 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -1,3 +1,27 @@ +2.3.0 +----- + +Smarty now has a {debug} template function that brings up the debugging console +right where {debug} is called, regardless of $debugging settings. This works a +little different than turning on $debugging in the sense that it shows all the +template variables available at the time {debug} is called, including local +scope vars. It does not show the templates names however, since this +executed during runtime of the template. + +You can now supply an expire time when clearing cache or compile files. This is +mostly useful for removing stale files via the API. + +Plugins now stop execution upon error, instead of outputting a warning and +continuing. + +Two new API functions, assign_by_ref() and append_by_ref() were added. They +allow assigning template variables by reference. This can make a significance +performance gain, especially if you are assigning large arrays of data. PHP 5.0 +will do this implicitly, so these functions are basically workarounds. + +Several misc bug fixes, see the Change Log for information. + + 2.2.0 ----- diff --git a/Smarty.class.php b/Smarty.class.php index 8188e353..f35d7e3e 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -5,7 +5,7 @@ * Author: Monte Ohrt * Andrei Zmievski * - * Version: 2.2.0 + * Version: 2.3.0 * Copyright: 2001,2002 ispi of Lincoln, Inc. * * This library is free software; you can redistribute it and/or @@ -171,7 +171,7 @@ class Smarty var $_conf_obj = null; // configuration object var $_config = array(); // loaded configuration settings var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f'; // md5 checksum of the string 'Smarty' - var $_version = '2.2.0'; // Smarty version number + var $_version = '2.3.0'; // Smarty version number var $_extract = false; // flag for custom functions var $_inclusion_depth = 0; // current template inclusion depth var $_compile_id = null; // for different compiled templates diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php index 322df8ba..50e26f58 100644 --- a/Smarty_Compiler.class.php +++ b/Smarty_Compiler.class.php @@ -6,7 +6,7 @@ * Author: Monte Ohrt * Andrei Zmievski * - * Version: 2.2.0 + * Version: 2.3.0 * Copyright: 2001,2002 ispi of Lincoln, Inc. * * This library is free software; you can redistribute it and/or diff --git a/docs/appendixes.sgml b/docs/appendixes.sgml index 60f45e5d..19de45b2 100644 --- a/docs/appendixes.sgml +++ b/docs/appendixes.sgml @@ -158,10 +158,11 @@ footer.tpl Dates - As a rule of thumb, always pass dates to Smarty as timestamps. - This allows template designers to use date_format for full control over date - formatting, and also makes it easy to compare dates if necessary. + As a rule of thumb, always pass dates to Smarty as timestamps. This + allows template designers to use date_format for full + control over date formatting, and also makes it easy to compare dates if + necessary. NOTE: As of Smarty 1.4.0, you can pass dates to Smarty as unix diff --git a/docs/designers.sgml b/docs/designers.sgml index b2059346..88ef944e 100644 --- a/docs/designers.sgml +++ b/docs/designers.sgml @@ -362,7 +362,7 @@ Topic: {$topic|truncate:40:"..."} elements in the $articleTitle array.) - + capitalize This is used to capitalize the first letter of all words in a variable. @@ -379,7 +379,7 @@ Police begin campaign to rundown jaywalkers. Police Begin Campaign To Rundown Jaywalkers. - + count_characters This is used to count the number of characters in a variable. @@ -397,7 +397,7 @@ Cold Wave Linked to Temperatures 32 - + count_paragraphs This is used to count the number of paragraphs in a variable. @@ -417,7 +417,7 @@ Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation. 2 - + count_sentences This is used to count the number of sentences in a variable. @@ -435,7 +435,7 @@ Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe. 2 - + count_words This is used to count the number of words in a variable. @@ -453,7 +453,7 @@ Dealers Will Hear Car Talk at Noon. 7 - + date_format @@ -599,7 +599,7 @@ system's manpage for a full list of valid specifiers. - + default @@ -645,7 +645,7 @@ OUTPUT: no title - + escape @@ -709,7 +709,7 @@ OUTPUT: href="mailto:%62%6f%62%40%6d%65%2e%6e%65%74">&#x62;&#x6f;&#x62;&#x40;&#x6d;&#x65;&#x2e;&#x6e;&#x65;&#x74;</a> - + indent @@ -782,7 +782,7 @@ Statistics show that teen pregnancy drops off significantly after 25. Statistics show that teen pregnancy drops off significantly after 25. - + lower This is used to lowercase a variable. @@ -799,7 +799,7 @@ Two Convicts Evade Noose, Jury Hung. two convicts evade noose, jury hung. - + regex_replace @@ -854,7 +854,7 @@ Infertility unlikely to Infertility unlikely to be passed on, experts say - + replace @@ -907,7 +907,7 @@ Child's Stool Great for Use in Vineyard. Child's Stool Great for Use in Garden. - + spacify @@ -955,7 +955,7 @@ S o m e t h i n g W e n t W r o n g i n J e t C r a s h , E x p e r S^^o^^m^^e^^t^^h^^i^^n^^g^^ ^^W^^e^^n^^t^^ ^^W^^r^^o^^n^^g^^ ^^i^^n^^ ^^J^^e^^t^^ ^^C^^r^^a^^s^^h^^,^^ ^^E^^x^^p^^e^^r^^t^^s^^ ^^S^^a^^y^^. - + string_format @@ -1002,7 +1002,7 @@ OUTPUT: 24 - + strip_tags This strips out markup tags, basically anything between < and >. @@ -1019,7 +1019,7 @@ Blind Woman Gets <font face="helvetica">New Kidney</font> from Dad s Blind Woman Gets New Kidney from Dad she Hasn't Seen in years. - + truncate @@ -1095,7 +1095,7 @@ Two Sisters Reunite after Eigh Two Sisters Reunite after E... - + upper This is used to uppercase a variable. @@ -1112,7 +1112,7 @@ If Strike isn't Settled Quickly it may Last a While. IF STRIKE ISN'T SETTLED QUICKLY IT MAY LAST A WHILE. - + wordwrap @@ -2233,7 +2233,7 @@ e-mail: jane@mydomain.com<p> supported, but you will only see reference to the new syntax in the manual examples. - + index index is used to display the current loop index, starting with zero @@ -2264,7 +2264,7 @@ e-mail: jane@mydomain.com<p> - + index_prev index_prev is used to display the previous loop index. @@ -2293,7 +2293,7 @@ e-mail: jane@mydomain.com<p> - + index_next index_next is used to display the next loop index. On the last @@ -2323,7 +2323,7 @@ e-mail: jane@mydomain.com<p> - + iteration iteration is used to display the current loop iteration. @@ -2359,7 +2359,7 @@ e-mail: jane@mydomain.com<p> - + first first is set to true if the current section iteration is the first @@ -2392,7 +2392,7 @@ e-mail: jane@mydomain.com<p> - + last last is set to true if the current section iteration is the last @@ -2425,7 +2425,7 @@ e-mail: jane@mydomain.com<p> - + rownum rownum is used to display the current loop iteration, @@ -2447,7 +2447,7 @@ e-mail: jane@mydomain.com<p> - + loop loop is used to display the last index number that this section @@ -2472,7 +2472,7 @@ e-mail: jane@mydomain.com<p> - + show show is used as a parameter to section. @@ -2506,7 +2506,7 @@ e-mail: jane@mydomain.com<p> - + total total is used to display the number of iterations that this section @@ -2833,6 +2833,44 @@ OUTPUT: #eeeeee + + debug + + + + + + + + + + Attribute Name + Type + Required + Default + Description + + + + + output + string + No + html + output type, html or javascript + + + + + + {debug} dumps the debug console to the page. This works regardless + of the debug + settings in Smarty. Since this gets executed at runtime, this is + only able to show the assigned variables, not the templates that + are in use. But, you see all the currently available variables + within the scope of this template. + + eval @@ -4325,18 +4363,20 @@ pass=foobar Debugging Console - There is a debugging console included with Smarty. The console informs you - of all the included templates, assigned variables and config file variables - for the current invocation of the template. A template named "debug.tpl" is - included with the distribution of Smarty which controls the formatting of - the console. Set $debugging to true in Smarty, and if needed set $debug_tpl - to the template resource path for debug.tpl (this is in $template_dir by - default.) When you load the page, a javascript console window should pop up - and give you the names of all the included templates and assigned variables - for the current page. To disable the debugging console, set $debugging to - false. You can also temporarily turn on the debugging console by putting - SMARTY_DEBUG in the URL if you enable this option with $debugging_ctrl. + There is a debugging console included with Smarty. The console informs you + of all the included templates, assigned variables and config file variables + for the current invocation of the template. A template named "debug.tpl" is + included with the distribution of Smarty which controls the formatting of + the console. Set $debugging to true in Smarty, and if needed set $debug_tpl + to the template resource path for debug.tpl (this is in SMARTY_DIR by + default.) When you load the page, a javascript console window should pop up + and give you the names of all the included templates and assigned variables + for the current page. To see the available variables for a particular + templates, see the {debug} + template function. To disable the debugging console, set $debugging to + false. You can also temporarily turn on the debugging console by putting + SMARTY_DEBUG in the URL if you enable this option with $debugging_ctrl. Technical Note diff --git a/docs/programmers.sgml b/docs/programmers.sgml index ac006597..e837123b 100644 --- a/docs/programmers.sgml +++ b/docs/programmers.sgml @@ -452,6 +452,16 @@ $smarty->autoload_filters = array('pre' => array('trim', 'stamp'), if you can. + + $default_modifiers + + This is an array of modifiers to implicitly apply to every variable in a + template. For example, to HTML-escape every variable by default, use + array('escape:"htmlall"'); To make a variable exempt from default + modifiers, pass the special "nodefaults" modifier to it, such as + {$var|nodefaults}. + + @@ -483,6 +493,38 @@ $smarty->append("Address",$address); // passing an associative array $smarty->append(array("city" => "Lincoln","state" => "Nebraska")); + + + + append_by_ref + + + void assign + string varname + mixed var + + + + This is used to append values to the templates by reference instead of + making a copy. See the PHP manual on variable referencing for an explanation. + + + Technical Note + + assign_by_append() is more efficient than append() since it does not create + an in-memory copy of the variable. Instead it refers to the actual + variable in the memory heap. Be aware if you alter the original variable + after it is assigned, the assigned variable sees the changes! PHP 5.0 + will take care of referencing automatically, so this function acts as a + workaround. + + + + append_by_ref + +// appending name/value pairs +$smarty->append_by_ref("Name",$myname); +$smarty->append_by_ref("Address",$address); @@ -512,6 +554,38 @@ $smarty->assign("Address",$address); // passing an associative array $smarty->assign(array("city" => "Lincoln","state" => "Nebraska")); + + + + assign_by_ref + + + void assign + string varname + mixed var + + + + This is used to assign values to the templates by reference instead of + making a copy. See the PHP manual on variable referencing for an explanation. + + + Technical Note + + assign_by_ref() is more efficient than assign() since it does not create + an in-memory copy of the variable. Instead it refers to the actual + variable in the memory heap. Be aware if you alter the original variable + after it is assigned, the assigned variable sees the changes! PHP 5.0 + will take care of referencing automatically, so this function acts as a + workaround. + + + + assign_by_ref + +// passing name/value pairs +$smarty->assign_by_ref("Name",$myname); +$smarty->assign_by_ref("Address",$address); @@ -537,11 +611,13 @@ $smarty->clear_all_assign(); void clear_all_cache - + int expire time - This clears the entire template cache. + This clears the entire template cache. As an optional + parameter, you can supply a minimum age in seconds the cache + files must be before they will get cleared. clear_all_cache @@ -580,6 +656,7 @@ $smarty->clear_assign(array("Name","Address","Zip")); string template string cache id string compile id + int expire time @@ -588,8 +665,10 @@ $smarty->clear_assign(array("Name","Address","Zip")); cache by supplying the cache id as the second parameter. You can also pass a compile id as a third paramter. You can "group" templates together so they can be removed as a group. See the - caching section for - more information. + caching section for more + information. As an optional fourth parameter, you can supply a + minimum age in seconds the cache file must be before it will + get cleared. clear_cache diff --git a/libs/Config_File.class.php b/libs/Config_File.class.php index 2212f5d5..bfe0e778 100644 --- a/libs/Config_File.class.php +++ b/libs/Config_File.class.php @@ -3,7 +3,7 @@ /** * Config_File class. * - * @version 2.2.0 + * @version 2.3.0 * @author Andrei Zmievski * @access public * diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 8188e353..f35d7e3e 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -5,7 +5,7 @@ * Author: Monte Ohrt * Andrei Zmievski * - * Version: 2.2.0 + * Version: 2.3.0 * Copyright: 2001,2002 ispi of Lincoln, Inc. * * This library is free software; you can redistribute it and/or @@ -171,7 +171,7 @@ class Smarty var $_conf_obj = null; // configuration object var $_config = array(); // loaded configuration settings var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f'; // md5 checksum of the string 'Smarty' - var $_version = '2.2.0'; // Smarty version number + var $_version = '2.3.0'; // Smarty version number var $_extract = false; // flag for custom functions var $_inclusion_depth = 0; // current template inclusion depth var $_compile_id = null; // for different compiled templates diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 322df8ba..50e26f58 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -6,7 +6,7 @@ * Author: Monte Ohrt * Andrei Zmievski * - * Version: 2.2.0 + * Version: 2.3.0 * Copyright: 2001,2002 ispi of Lincoln, Inc. * * This library is free software; you can redistribute it and/or