From 9da97c1043134fd4903ccc4a833cab8d178e8526 Mon Sep 17 00:00:00 2001 From: andrey Date: Wed, 27 Jun 2001 16:44:26 +0000 Subject: [PATCH] Negative values of 'max' will mean no max. --- Smarty_Compiler.class.php | 6 +++--- libs/Smarty_Compiler.class.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php index 411c3024..ec8fadea 100644 --- a/Smarty_Compiler.class.php +++ b/Smarty_Compiler.class.php @@ -436,9 +436,6 @@ class Smarty_Compiler extends Smarty { break; case 'max': - $output .= "{$section_props}['$attr_name'] = max(0, (int)$attr_value);\n"; - break; - case 'start': $output .= "{$section_props}['$attr_name'] = (int)$attr_value;\n"; break; @@ -454,6 +451,9 @@ class Smarty_Compiler extends Smarty { if (!isset($attrs['max'])) $output .= "{$section_props}['max'] = {$section_props}['loop'];\n"; + else + $output .= "if ({$section_props}['max'] < 0)\n" . + " {$section_props}['max'] = {$section_props}['loop'];\n"; if (!isset($attrs['start'])) $output .= "{$section_props}['start'] = 0;\n"; diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 411c3024..ec8fadea 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -436,9 +436,6 @@ class Smarty_Compiler extends Smarty { break; case 'max': - $output .= "{$section_props}['$attr_name'] = max(0, (int)$attr_value);\n"; - break; - case 'start': $output .= "{$section_props}['$attr_name'] = (int)$attr_value;\n"; break; @@ -454,6 +451,9 @@ class Smarty_Compiler extends Smarty { if (!isset($attrs['max'])) $output .= "{$section_props}['max'] = {$section_props}['loop'];\n"; + else + $output .= "if ({$section_props}['max'] < 0)\n" . + " {$section_props}['max'] = {$section_props}['loop'];\n"; if (!isset($attrs['start'])) $output .= "{$section_props}['start'] = 0;\n";