update cycle function to handle array as input, update files to 2.1.1

This commit is contained in:
mohrt
2002-05-07 14:16:34 +00:00
parent 7ee4e41e17
commit 5b70385282
10 changed files with 39 additions and 15 deletions

3
NEWS
View File

@@ -1,3 +1,6 @@
Version 2.1.1
-------------
- added cycle function (Monte)
- fixed bug with resource testing, and include_path (Monte)
- fixed a bug with register_outputfilter function (Monte)

2
README
View File

@@ -2,7 +2,7 @@ NAME:
Smarty - the PHP compiling template engine
VERSION: 2.1.0
VERSION: 2.1.1
AUTHORS:

View File

@@ -1,3 +1,11 @@
2.1.1
-----
There was a bug with template paths and the include_path, this has been fixed.
Also register_outputfilter() did not work, this is fixed. A new template
function named "cycle" has been added to the distribution, nice for cycling
through a list (or array) of values.
2.1.0
-----

View File

@@ -5,7 +5,7 @@
* Author: Monte Ohrt <monte@ispi.net>
* Andrei Zmievski <andrei@php.net>
*
* Version: 2.1.0
* Version: 2.1.1
* Copyright: 2001,2002 ispi of Lincoln, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -164,7 +164,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.1.0'; // Smarty version number
var $_version = '2.1.1'; // 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

View File

@@ -6,7 +6,7 @@
* Author: Monte Ohrt <monte@ispi.net>
* Andrei Zmievski <andrei@php.net>
*
* Version: 2.1.0
* Version: 2.1.1
* Copyright: 2001,2002 ispi of Lincoln, Inc.
*
* This library is free software; you can redistribute it and/or

View File

@@ -2754,11 +2754,12 @@ OUTPUT:
</row>
<row>
<entry>values</entry>
<entry>string</entry>
<entry>mixed</entry>
<entry>Yes</entry>
<entry><emphasis>N/A</emphasis></entry>
<entry>The values to cycle through, delimited by comma,
or specified in delimiter attribute</entry>
<entry>The values to cycle through, either a comma
delimited list (see delimiter attribute), or an array
of values.</entry>
</row>
<row>
<entry>print</entry>
@@ -2779,7 +2780,7 @@ OUTPUT:
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>,</emphasis></entry>
<entry>The value delimiter</entry>
<entry>The delimiter to use in the values attribute.</entry>
</row>
</tbody>
</tgroup>

View File

@@ -5,7 +5,7 @@
* Author: Monte Ohrt <monte@ispi.net>
* Andrei Zmievski <andrei@php.net>
*
* Version: 2.1.0
* Version: 2.1.1
* Copyright: 2001,2002 ispi of Lincoln, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -164,7 +164,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.1.0'; // Smarty version number
var $_version = '2.1.1'; // 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

View File

@@ -6,7 +6,7 @@
* Author: Monte Ohrt <monte@ispi.net>
* Andrei Zmievski <andrei@php.net>
*
* Version: 2.1.0
* Version: 2.1.1
* Copyright: 2001,2002 ispi of Lincoln, Inc.
*
* This library is free software; you can redistribute it and/or

View File

@@ -13,8 +13,10 @@
* Jason Sweat <jsweat_php@yahoo.com>
* Purpose: cycle through given values
* Input: name = name of cycle (optional)
* values = comma separated list of values to cycle
* values = comma separated list of values to cycle,
* or an array of values to cycle
* (this can be left out for subsequent calls)
*
* reset = boolean - resets given var to true
* print = boolean - print var or not. default is true
* advance = boolean - whether or not to advance the cycle
@@ -62,7 +64,11 @@ function smarty_function_cycle($params, &$smarty)
$cycle_vars[$name]['values'] = $values;
}
$cycle_array = explode($delimiter,$cycle_vars[$name]['values']);
if(!is_array($cycle_vars[$name]['values'])) {
$cycle_array = explode($delimiter,$cycle_vars[$name]['values']);
} else {
$cycle_array = $cycle_vars[$name]['values'];
}
if(!isset($cycle_vars[$name]['index']) || $reset ) {
$cycle_vars[$name]['index'] = 0;

View File

@@ -13,8 +13,10 @@
* Jason Sweat <jsweat_php@yahoo.com>
* Purpose: cycle through given values
* Input: name = name of cycle (optional)
* values = comma separated list of values to cycle
* values = comma separated list of values to cycle,
* or an array of values to cycle
* (this can be left out for subsequent calls)
*
* reset = boolean - resets given var to true
* print = boolean - print var or not. default is true
* advance = boolean - whether or not to advance the cycle
@@ -62,7 +64,11 @@ function smarty_function_cycle($params, &$smarty)
$cycle_vars[$name]['values'] = $values;
}
$cycle_array = explode($delimiter,$cycle_vars[$name]['values']);
if(!is_array($cycle_vars[$name]['values'])) {
$cycle_array = explode($delimiter,$cycle_vars[$name]['values']);
} else {
$cycle_array = $cycle_vars[$name]['values'];
}
if(!isset($cycle_vars[$name]['index']) || $reset ) {
$cycle_vars[$name]['index'] = 0;