Plamen Petkov
|
Saturday 01 May 2004 4:16:33 am
Suggesting the following code change:
--- lib/eztemplate/classes/eztemplatephpoperator.php.original Sat May 1 13:43:13 2004
+++ lib/eztemplate/classes/eztemplatephpoperator.php Sat May 1 19:30:39 2004
@@ -83,7 +83,16 @@
function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$value )
{
$phpname = $this->PHPNames[$operatorName];
- $value = $phpname( $value );
+ if ( ! is_array($value) )
+ $arguments = "\"$value\"";
+ else
+ {
+ $arguments_array = array();
+ while ( list($key,$val)=each($value) ) $arguments_array[]= "\"" . $val . "\"";
+ $arguments = implode($arguments_array,",");
+ }
+ $code = "\$value = $phpname($arguments);";
+ eval($code); } Usage Example ("random", "uniqueid", "explodearray" operators are registered in settings/override/template.ini): {array(1,100)|random} {array("ID_", true())|uniqueid}
{let test=array(",", "v1,v2,v3")|explodearray}
{$test[0] $test[1] $test[2]} {/let}
|