From 1f12a0f3e0444897c42d39e8ece2a8d306962346 Mon Sep 17 00:00:00 2001 From: mohrt Date: Fri, 13 Dec 2002 15:40:53 +0000 Subject: [PATCH] add day_value_format to html_select_date --- NEWS | 2 ++ docs/designers.sgml | 9 ++++++++- libs/plugins/function.html_select_date.php | 10 ++++++++-- plugins/function.html_select_date.php | 10 ++++++++-- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index a1478ccf..41b75783 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ + - added day_value_format to html_select_date (Marcus + Bointon, Monte) - assigned variables are not longer in global namespace, saving extract() calls and speeding up fetch() and display() linearly with no. of diff --git a/docs/designers.sgml b/docs/designers.sgml index a8b5d80e..00bf29bc 100644 --- a/docs/designers.sgml +++ b/docs/designers.sgml @@ -3494,7 +3494,14 @@ OUTPUT: string No %02d - what format the day should be in (sprintf) + what format the day output should be in (sprintf) + + + day_value_format + string + No + %d + what format the day value should be in (sprintf) year_as_text diff --git a/libs/plugins/function.html_select_date.php b/libs/plugins/function.html_select_date.php index f5b77658..e4dca646 100644 --- a/libs/plugins/function.html_select_date.php +++ b/libs/plugins/function.html_select_date.php @@ -15,6 +15,8 @@ * time value. (Jan Rosier) * 1.3 added support for choosing format for * month values (Gary Loescher) + * 1.3.1 added support for choosing format for + * day values (Marcus Bointon) * ------------------------------------------------------------- */ require_once $this->_get_plugin_filepath('shared','make_timestamp'); @@ -32,6 +34,8 @@ function smarty_function_html_select_date($params, &$smarty) /* Write months as numbers by default GL */ $month_value_format = "%m"; $day_format = "%02d"; + /* Write day values using this format MB */ + $day_value_format = "%d"; $year_as_text = false; /* Display years in reverse order? Ie. 2000,1999,.... */ $reverse_years = false; @@ -128,8 +132,10 @@ function smarty_function_html_select_date($params, &$smarty) if ($display_days) { $days = array(); - for ($i = 1; $i <= 31; $i++) + for ($i = 1; $i <= 31; $i++) { $days[] = sprintf($day_format, $i); + $day_values[] = sprintf($day_value_format, $i); + } $day_result .= ''."\n"; $day_result .= smarty_function_html_options(array('output' => $days, - 'values' => range(1, 31), + 'values' => $day_values, 'selected' => $time[2], 'print_result' => false), $smarty);