cvs: smarty / Config_File.class.php NEWS README RELEASE_NOTES Smarty.class.php Smarty_Compiler.class.php /docs appendixes.sgml designers.sgml
programmers.sgml

From: Date: Wed, 07 Aug 2002 14:57:34 +0000
Subject: cvs: smarty / Config_File.class.php NEWS README RELEASE_NOTES Smarty.class.php Smarty_Compiler.class.php /docs appendixes.sgml designers.sgml
programmers.sgml
Groups: php.smarty.cvs 
Request: Send a blank email to php-smarty-cvs+get-225@lists.php.net to get a copy of this message
mohrt Wed Aug 7 10:57:34 2002 EDT Modified files: /smarty Config_File.class.php NEWS README RELEASE_NOTES Smarty.class.php Smarty_Compiler.class.php /smarty/docs appendixes.sgml designers.sgml programmers.sgml Log: update files with new version numbers

Index: smarty/Config_File.class.php diff -u smarty/Config_File.class.php:1.33 smarty/Config_File.class.php:1.34 --- smarty/Config_File.class.php:1.33 Tue Jul 23 09:39:59 2002 +++ smarty/Config_File.class.php Wed Aug 7 10:57:33 2002 @@ -3,7 +3,7 @@ /** * Config_File class. * - * @version 2.2.0 + * @version 2.3.0 * @author Andrei Zmievski <andrei@php.net> * @access public * Index: smarty/NEWS diff -u smarty/NEWS:1.227 smarty/NEWS:1.228 --- smarty/NEWS:1.227 Fri Aug 2 14:23:25 2002 +++ smarty/NEWS Wed Aug 7 10:57:33 2002 @@ -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 Index: smarty/README diff -u smarty/README:1.46 smarty/README:1.47 --- smarty/README:1.46 Thu Jul 11 11:18:39 2002 +++ smarty/README Wed Aug 7 10:57:33 2002 @@ -2,7 +2,7 @@ Smarty - the PHP compiling template engine -VERSION: 2.2.0 +VERSION: 2.3.0 AUTHORS: Index: smarty/RELEASE_NOTES diff -u smarty/RELEASE_NOTES:1.35 smarty/RELEASE_NOTES:1.36 --- smarty/RELEASE_NOTES:1.35 Thu Jul 11 11:23:42 2002 +++ smarty/RELEASE_NOTES Wed Aug 7 10:57:33 2002 @@ -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 ----- Index: smarty/Smarty.class.php diff -u smarty/Smarty.class.php:1.310 smarty/Smarty.class.php:1.311 --- smarty/Smarty.class.php:1.310 Fri Aug 2 14:17:40 2002 +++ smarty/Smarty.class.php Wed Aug 7 10:57:33 2002 @@ -5,7 +5,7 @@ * Author: Monte Ohrt <monte@ispi.net> * Andrei Zmievski <andrei@php.net> * - * 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 @@ 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 Index: smarty/Smarty_Compiler.class.php diff -u smarty/Smarty_Compiler.class.php:1.125 smarty/Smarty_Compiler.class.php:1.126 --- smarty/Smarty_Compiler.class.php:1.125 Thu Jul 18 09:29:16 2002 +++ smarty/Smarty_Compiler.class.php Wed Aug 7 10:57:33 2002 @@ -6,7 +6,7 @@ * Author: Monte Ohrt <monte@ispi.net> * Andrei Zmievski <andrei@php.net> * - * 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 Index: smarty/docs/appendixes.sgml diff -u smarty/docs/appendixes.sgml:1.9 smarty/docs/appendixes.sgml:1.10 --- smarty/docs/appendixes.sgml:1.9 Wed Jun 26 17:17:27 2002 +++ smarty/docs/appendixes.sgml Wed Aug 7 10:57:34 2002 @@ -158,10 +158,11 @@ <sect1 id="tips.dates"> <title>Dates</title> <para> - As a rule of thumb, always pass dates to Smarty as timestamps. - This allows template designers to use <link - linkend="date.format">date_format</link> 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 <link + linkend="language.modifier.date.format">date_format</link> for full + control over date formatting, and also makes it easy to compare dates if + necessary. </para> <para> NOTE: As of Smarty 1.4.0, you can pass dates to Smarty as unix Index: smarty/docs/designers.sgml diff -u smarty/docs/designers.sgml:1.39 smarty/docs/designers.sgml:1.40 --- smarty/docs/designers.sgml:1.39 Mon Jul 29 10:21:53 2002 +++ smarty/docs/designers.sgml Wed Aug 7 10:57:34 2002 @@ -362,7 +362,7 @@ elements in the $articleTitle array.) </para> - <sect1> + <sect1 id="language.modifier.capitalize"> <title>capitalize</title> <para> This is used to capitalize the first letter of all words in a variable. @@ -379,7 +379,7 @@ Police Begin Campaign To Rundown Jaywalkers.</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.count.characters"> <title>count_characters</title> <para> This is used to count the number of characters in a variable. @@ -397,7 +397,7 @@ 32</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.count.paragraphs"> <title>count_paragraphs</title> <para> This is used to count the number of paragraphs in a variable. @@ -417,7 +417,7 @@ 2</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.count.sentences"> <title>count_sentences</title> <para> This is used to count the number of sentences in a variable. @@ -435,7 +435,7 @@ 2</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.count.words"> <title>count_words</title> <para> This is used to count the number of words in a variable. @@ -453,7 +453,7 @@ 7</programlisting> </example> </sect1> - <sect1 id="date.format"> + <sect1 id="language.modifier.date.format"> <title>date_format</title> <informaltable frame=all> <tgroup cols=5> @@ -599,7 +599,7 @@ </example> </sect1> - <sect1> + <sect1 id="language.modifier.default"> <title>default</title> <informaltable frame=all> <tgroup cols=5> @@ -645,7 +645,7 @@ no title</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.escape"> <title>escape</title> <informaltable frame=all> <tgroup cols=6> @@ -709,7 +709,7 @@ href="mailto:%62%6f%62%40%6d%65%2e%6e%65%74"&gt;&amp;#x62;&amp;#x6f;&amp;#x62;&amp;#x40;&amp;#x6d;&amp;#x65;&amp;#x2e;&amp;#x6e;&amp;#x65;&amp;#x74;&lt;/a&gt;</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.indent"> <title>indent</title> <informaltable frame=all> <tgroup cols=5> @@ -782,7 +782,7 @@ Statistics show that teen pregnancy drops off significantly after 25.</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.lower"> <title>lower</title> <para> This is used to lowercase a variable. @@ -799,7 +799,7 @@ two convicts evade noose, jury hung.</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.regex.replace"> <title>regex_replace</title> <informaltable frame=all> <tgroup cols=5> @@ -854,7 +854,7 @@ Infertility unlikely to be passed on, experts say</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.replace"> <title>replace</title> <informaltable frame=all> <tgroup cols=5> @@ -907,7 +907,7 @@ Child's Stool Great for Use in Garden.</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.spacify"> <title>spacify</title> <informaltable frame=all> <tgroup cols=5> @@ -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^^t^^s^^ ^^S^^a^^y^^.</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.string.format"> <title>string_format</title> <informaltable frame=all> <tgroup cols=5> @@ -1002,7 +1002,7 @@ 24</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.strip.tags"> <title>strip_tags</title> <para> This strips out markup tags, basically anything between &lt; and &gt;. @@ -1019,7 +1019,7 @@ Blind Woman Gets New Kidney from Dad she Hasn't Seen in years.</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.truncate"> <title>truncate</title> <informaltable frame=all> <tgroup cols=5> @@ -1095,7 +1095,7 @@ Two Sisters Reunite after E...</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.upper"> <title>upper</title> <para> This is used to uppercase a variable. @@ -1112,7 +1112,7 @@ IF STRIKE ISN'T SETTLED QUICKLY IT MAY LAST A WHILE.</programlisting> </example> </sect1> - <sect1> + <sect1 id="language.modifier.wordwrap"> <title>wordwrap</title> <informaltable frame=all> <tgroup cols=5> @@ -2233,7 +2233,7 @@ supported, but you will only see reference to the new syntax in the manual examples. </para> - <sect2> + <sect2 id="section.property.index"> <title>index</title> <para> index is used to display the current loop index, starting with zero @@ -2264,7 +2264,7 @@ </programlisting> </example> </sect2> - <sect2> + <sect2 id="section.property.index.prev"> <title>index_prev</title> <para> index_prev is used to display the previous loop index. @@ -2293,7 +2293,7 @@ </programlisting> </example> </sect2> - <sect2> + <sect2 id="section.property.index.next"> <title>index_next</title> <para> index_next is used to display the next loop index. On the last @@ -2323,7 +2323,7 @@ </programlisting> </example> </sect2> - <sect2> + <sect2 id="section.property.iteration"> <title>iteration</title> <para> iteration is used to display the current loop iteration. @@ -2359,7 +2359,7 @@ </programlisting> </example> </sect2> - <sect2> + <sect2 id="section.property.first"> <title>first</title> <para> first is set to true if the current section iteration is the first @@ -2392,7 +2392,7 @@ </programlisting> </example> </sect2> - <sect2> + <sect2 id="section.property.last"> <title>last</title> <para> last is set to true if the current section iteration is the last @@ -2425,7 +2425,7 @@ </programlisting> </example> </sect2> - <sect2> + <sect2 id="section.property.rownum"> <title>rownum</title> <para> rownum is used to display the current loop iteration, @@ -2447,7 +2447,7 @@ </programlisting> </example> </sect2> - <sect2> + <sect2 id="section.property.loop"> <title>loop</title> <para> loop is used to display the last index number that this section @@ -2472,7 +2472,7 @@ </programlisting> </example> </sect2> - <sect2> + <sect2 id="section.property.show"> <title>show</title> <para> <emphasis>show</emphasis> is used as a parameter to section. @@ -2506,7 +2506,7 @@ </programlisting> </example> </sect2> - <sect2> + <sect2 id="section.property.total"> <title>total</title> <para> total is used to display the number of iterations that this section @@ -2833,6 +2833,44 @@ #eeeeee</programlisting> </example> </sect1> + <sect1 id="language.function.debug"> + <title>debug</title> + <informaltable frame=all> + <tgroup cols=5> + <colspec colname=param align=center> + <colspec colname=type align=center> + <colspec colname=required align=center> + <colspec colname=default align=center> + <colspec colname=desc> + <thead> + <row> + <entry>Attribute Name</entry> + <entry>Type</entry> + <entry>Required</entry> + <entry>Default</entry> + <entry>Description</entry> + </row> + </thead> + <tbody> + <row> + <entry>output</entry> + <entry>string</entry> + <entry>No</entry> + <entry><emphasis>html</emphasis></entry> + <entry>output type, html or javascript</entry> + </row> + </tbody> + </tgroup> + </informaltable> + <para> + {debug} dumps the debug console to the page. This works regardless + of the <link linkend="chapter.debugging.console">debug</link> + 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. + </para> + </sect1> <sect1 id="language.function.eval"> <title>eval</title> <informaltable frame=all> @@ -4325,18 +4363,20 @@ <chapter id="chapter.debugging.console"> <title>Debugging Console</title> <para> - 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 <link - linkend="variable.debugging.ctrl">$debugging_ctrl</link>. + 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 <link linkend="language.function.debug">{debug}</link> + 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 <link + linkend="variable.debugging.ctrl">$debugging_ctrl</link>. </para> <note> <title>Technical Note</title> Index: smarty/docs/programmers.sgml diff -u smarty/docs/programmers.sgml:1.17 smarty/docs/programmers.sgml:1.18 --- smarty/docs/programmers.sgml:1.17 Tue Jul 23 09:52:23 2002 +++ smarty/docs/programmers.sgml Wed Aug 7 10:57:34 2002 @@ -452,6 +452,16 @@ if you can. </para> </sect1> + <sect1 id="variable.default.modifiers"> + <title>$default_modifiers</title> + <para> + 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}. + </para> + </sect1> </chapter> <chapter id="api.functions"> @@ -485,6 +495,38 @@ $smarty->append(array("city" => "Lincoln","state" => "Nebraska"));</programlisting> </example> </sect1> + <sect1 id="api.append.by.ref"> + <title>append_by_ref</title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>assign</function></funcdef> + <paramdef>string <parameter>varname</parameter></paramdef> + <paramdef>mixed <parameter>var</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + 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. + </para> + <note> + <title>Technical Note</title> + <para> + 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. + </para> + </note> + <example> + <title>append_by_ref</title> + <programlisting> +// appending name/value pairs +$smarty->append_by_ref("Name",$myname); +$smarty->append_by_ref("Address",$address);</programlisting> +</example> + </sect1> <sect1 id="api.assign"> <title>assign</title> <funcsynopsis> @@ -514,6 +556,38 @@ $smarty->assign(array("city" => "Lincoln","state" => "Nebraska"));</programlisting> </example> </sect1> + <sect1 id="api.assign.by.ref"> + <title>assign_by_ref</title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>assign</function></funcdef> + <paramdef>string <parameter>varname</parameter></paramdef> + <paramdef>mixed <parameter>var</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + 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. + </para> + <note> + <title>Technical Note</title> + <para> + 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. + </para> + </note> + <example> + <title>assign_by_ref</title> + <programlisting> +// passing name/value pairs +$smarty->assign_by_ref("Name",$myname); +$smarty->assign_by_ref("Address",$address);</programlisting> +</example> + </sect1> <sect1 id="api.clear.all.assign"> <title>clear_all_assign</title> <funcsynopsis> @@ -537,11 +611,13 @@ <funcsynopsis> <funcprototype> <funcdef>void <function>clear_all_cache</function></funcdef> - <paramdef><parameter></parameter></paramdef> + <paramdef>int <parameter>expire time</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - 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. </para> <example> <title>clear_all_cache</title> @@ -580,6 +656,7 @@ <paramdef>string <parameter>template</parameter></paramdef> <paramdef>string <parameter>cache id</parameter></paramdef> <paramdef>string <parameter>compile id</parameter></paramdef> + <paramdef>int <parameter>expire time</parameter></paramdef> </funcprototype> </funcsynopsis> <para> @@ -588,8 +665,10 @@ 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 - <link linkend="caching">caching section</link> for - more information. + <link linkend="caching">caching section</link> 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. </para> <example> <title>clear_cache</title>
« previous php.smarty.cvs (#225) next »