cvs: smarty /libs/plugins function.html_select_date.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1096036622@cvsserver>
messju		Fri Sep 24 10:37:02 2004 EDT

  Modified files:              
    /smarty/libs/plugins	function.html_select_date.php 
  Log:
  fixed $start_year when no value for the year in $time is given.
  
  
  
http://cvs.php.net/diff.php/smarty/libs/plugins/function.html_select_date.php?r1=1.28&r2=1.29&ty=u
Index: smarty/libs/plugins/function.html_select_date.php
diff -u smarty/libs/plugins/function.html_select_date.php:1.28 smarty/libs/plugins/function.html_select_date.php:1.29
--- smarty/libs/plugins/function.html_select_date.php:1.28	Mon Aug 23 14:34:12 2004
+++ smarty/libs/plugins/function.html_select_date.php	Fri Sep 24 10:37:02 2004
@@ -152,13 +152,15 @@
             $start_year = strftime('%Y') - $match[2];
         }
     }
-    if($start_year > $time[0] && !isset($params['start_year'])) {
-        // force start year to include given date if not explicitly set
-        $start_year = $time[0];
-    }
-    if($end_year < $time[0] && !isset($params['end_year'])) {
-        // force end year to include given date if not explicitly set
-        $end_year = $time[0];
+    if (strlen($time[0]) > 0) { 
+        if ($start_year > $time[0] && !isset($params['start_year'])) {
+            // force start year to include given date if not explicitly set
+            $start_year = $time[0];
+        }
+        if($end_year < $time[0] && !isset($params['end_year'])) {
+            // force end year to include given date if not explicitly set
+            $end_year = $time[0];
+        }
     }
 
     $field_order = strtoupper($field_order);
@@ -256,6 +258,8 @@
             $years = range((int)$start_year, (int)$end_year);
             if ($reverse_years) {
                 rsort($years, SORT_NUMERIC);
+            } else {
+                sort($years, SORT_NUMERIC);
             }
             $yearvals = $years;
             if(isset($year_empty)) {

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.