|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
szen Smarty Rookie
Joined: 23 Dec 2003 Posts: 17
|
Posted: Tue Jun 26, 2012 9:44 pm Post subject: html_select_date - month_names bug |
|
|
I think there is bug in month_names parameter. There should be 12 index array. And i did put 12 month names. But the first one is being cut off, and last one is empty.
Original code:
Code: |
for ($i = 1; $i <= 12; $i++) {
$_val = sprintf('%02d', $i+1);
$_text = isset($month_names) ? smarty_function_escape_special_chars($month_names[$i]) : ($month_format == "%m" ? $_val : strftime($month_format, $_month_timestamps[$i]));
$_value = $month_value_format == "%m" ? $_val : strftime($month_value_format, $_month_timestamps[$i]);
$_html_months .= '<option value="' . $_value . '"'
. ($_val == $_month ? ' selected="selected"' : '')
. '>' . $_text . '</option>' . $option_separator;
} |
Code after my changes
Code: | for ($i = 0; $i <= 11; $i++) {
$_val = sprintf('%02d', ($i+1));
$_text = isset($month_names) ? smarty_function_escape_special_chars($month_names[$i]) : ($month_format == "%m" ? $_val : strftime($month_format, $_month_timestamps[$i]));
$_value = $month_value_format == "%m" ? $_val : strftime($month_value_format, $_month_timestamps[$i]);
$_html_months .= '<option value="' . $_value . '"'
. ($_val == $_month ? ' selected="selected"' : '')
. '>' . $_text . '</option>' . $option_separator;
} |
Might not be proper way but did work for now |
|
Back to top |
|
rodneyrehm Administrator
Joined: 30 Mar 2007 Posts: 674 Location: Germany, border to Switzerland
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|