cvs: smarty / NEWS Smarty.class.php Smarty_Compiler.class.php TESTIMONIALS /docs designers.sgml getting-started.sgml

From: Date: Thu, 16 May 2002 16:15:50 +0000
Subject: cvs: smarty / NEWS Smarty.class.php Smarty_Compiler.class.php TESTIMONIALS /docs designers.sgml getting-started.sgml
Groups: php.smarty.cvs 
Request: Send a blank email to php-smarty-cvs+get-110@lists.php.net to get a copy of this message
mohrt Thu May 16 12:15:50 2002 EDT Modified files: /smarty NEWS Smarty.class.php Smarty_Compiler.class.php TESTIMONIALS /smarty/docs designers.sgml getting-started.sgml Log: add "once" attribute to php_include, update docs Index: smarty/NEWS diff -u smarty/NEWS:1.197 smarty/NEWS:1.198 --- smarty/NEWS:1.197 Thu May 9 10:40:55 2002 +++ smarty/NEWS Thu May 16 12:15:49 2002 @@ -1,3 +1,5 @@ + - added "once" attribute to php_include (Monte) + Version 2.1.1 ------------- - added cycle function. (Monte) Index: smarty/Smarty.class.php diff -u smarty/Smarty.class.php:1.275 smarty/Smarty.class.php:1.276 --- smarty/Smarty.class.php:1.275 Tue May 7 10:16:33 2002 +++ smarty/Smarty.class.php Thu May 16 12:15:49 2002 @@ -1092,7 +1092,7 @@ Function: _smarty_include_php() Purpose: called for included templates \*======================================================================*/ - function _smarty_include_php($_smarty_include_php_file, $_smarty_assign) + function _smarty_include_php($_smarty_include_php_file, $_smarty_assign, $_smarty_once) { $this->_get_php_resource($_smarty_include_php_file, $_smarty_resource_type, $_smarty_php_resource); @@ -1100,7 +1100,11 @@ if (!empty($_smarty_assign)) { ob_start(); if ($_smarty_resource_type == 'file') { - include_once($_smarty_php_resource); + if($_smarty_once) { + include_once($_smarty_php_resource); + } else { + include($_smarty_php_resource); + } } else { eval($_smarty_php_resource); } @@ -1108,7 +1112,11 @@ ob_end_clean(); } else { if ($_smarty_resource_type == 'file') { - include_once($_smarty_php_resource); + if($_smarty_once) { + include_once($_smarty_php_resource); + } else { + include($_smarty_php_resource); + } } else { eval($_smarty_php_resource); } Index: smarty/Smarty_Compiler.class.php diff -u smarty/Smarty_Compiler.class.php:1.113 smarty/Smarty_Compiler.class.php:1.114 --- smarty/Smarty_Compiler.class.php:1.113 Tue May 7 10:16:33 2002 +++ smarty/Smarty_Compiler.class.php Thu May 16 12:15:49 2002 @@ -632,8 +632,10 @@ } $assign_var = $this->_dequote($attrs['assign']); - - return "<?php \$this->_smarty_include_php($attrs[file], '$assign_var'); ?>"; + + $once_var = ( $attrs['once'] === false ) ? 'false' : 'true'; + + return "<?php \$this->_smarty_include_php($attrs[file], '$assign_var', $once_var); ?>"; } Index: smarty/TESTIMONIALS diff -u smarty/TESTIMONIALS:1.6 smarty/TESTIMONIALS:1.7 --- smarty/TESTIMONIALS:1.6 Fri Apr 12 17:32:50 2002 +++ smarty/TESTIMONIALS Thu May 16 12:15:49 2002 @@ -57,3 +57,25 @@ have to work late all week re-writing our FastTemplate site :)" -- Robert V. Zwink + + +"Hello, sorry for my english, i'm french ... + +I've just discovered SMARTY ... +I've tested it ... +What a wonderful well-thinked product !!! +I am a fan of XML/XSLT, but with server-side script ; it's not "easy" to +build something strong. +But with smarty ; it's wonderful to separate the look from the code ... and +such easy ... +I've tested others templates system, no-one is better ... +I can't find my words in english to describe how many this product is +WELL-THINKED, and such good ... + +it's GREAT GREAT GREAT ! +And will use it for ever ... + +thanx A LOT for your good work !!! +you'll must have a "medal of honnor" for this product !" + + -- Marc Lentz Index: smarty/docs/designers.sgml diff -u smarty/docs/designers.sgml:1.28 smarty/docs/designers.sgml:1.29 --- smarty/docs/designers.sgml:1.28 Tue May 7 10:16:34 2002 +++ smarty/docs/designers.sgml Thu May 16 12:15:50 2002 @@ -1638,6 +1638,14 @@ <entry>The name of the php file to include</entry> </row> <row> + <entry>once</entry> + <entry>boolean</entry> + <entry>No</entry> + <entry><emphasis>true</emphasis></entry> + <entry>whether or not to include the php file more than + once if included multiple times</entry> + </row> + <row> <entry>assign</entry> <entry>string</entry> <entry>No</entry> @@ -1666,6 +1674,13 @@ before hand. </para> <para> + By default, php files are only included once even if called + multiple times in the template. You can specify that it should be + included every time with the <emphasis>once</emphasis> attribute. + Setting once to true will include the php script each time it is + included. + </para> + <para> You can optionally pass the <emphasis>assign</emphasis> attribute, which will specify a template variable name that the output of <emphasis>include_php</emphasis> will be assigned to instead of @@ -2786,8 +2801,23 @@ </tgroup> </informaltable> <para> - cycle is used to cycle though a set of values. This makes it easy to - alternate colors in a table, or even cycle through several of them. + Cycle is used to cycle though a set of values. This makes it easy + to alternate between two or more colors in a table, or cycle + through an array of values. + </para> + <para> + You can cycle through more than one set of values in your template + by supplying a name attribute. Give each set of values a unique + name. + </para> + <para> + You can force the current value not to print with the print + attribute set to false. This would be useful for silently skipping + a value. + </para> + <para> + The advance attribute is used to repeat a value. When set to true, + the next call to cycle will print the same value. </para> <para> If you supply the special "assign" attribute, the output of the @@ -2797,7 +2827,7 @@ <example> <title>cycle</title> <programlisting> -{* initialize the count *} +{* initialize the values *} {cycle values="#eeeeee,#d0d0d0"} {cycle} {cycle} Index: smarty/docs/getting-started.sgml diff -u smarty/docs/getting-started.sgml:1.7 smarty/docs/getting-started.sgml:1.8 --- smarty/docs/getting-started.sgml:1.7 Thu Apr 11 16:27:04 2002 +++ smarty/docs/getting-started.sgml Thu May 16 12:15:50 2002 @@ -116,16 +116,16 @@ <sect1 id="installing.smarty"> <title>Installing Smarty</title> <para> - Installing Smarty is fairly straightforward, there are a few things to - be aware of. Smarty creates PHP scripts from the templates. This - usually means allowing user "nobody" (or whomever the web server runs - as) to have permission to write the files. Each installation of a - Smarty application minimally needs a templates directory and a compiled - templates directory. If you use configuration files you will also need - a directory for those. By default these are named "templates", - "templates_c" and "configs" respectively. If you plan on using caching, - you will need to create a "cache" directory, also with permission to - write files. + Installing Smarty is fairly straightforward, there are a few things to be + aware of. Smarty creates PHP scripts from the templates. This usually means + allowing user "nobody" (or whomever the web server runs as) to have + permission to write the files. Each installation of a Smarty application + minimally needs a templates directory and a compiled templates directory. + If you use configuration files you will also need a directory for those. By + default these are named "templates", "templates_c" and "configs" + respectively. "templates_c" needs to be writable by the web server user. If + you plan on using caching, you will need to create a "cache" directory, + also with permission to write files. </para> <note> <title>Technical Note</title>

« previous php.smarty.cvs (#110) next »