cvs: smarty / NEWS /libs/plugins function.html_select_date.php
"Monte Ohrt" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmohrt1120829794@cvsserver> |
mohrt Fri Jul 8 09:36:34 2005 EDT
Modified files:
/smarty NEWS
/smarty/libs/plugins function.html_select_date.php
Log:
added passthru attribute feature to html_select_date
http://cvs.php.net/diff.php/smarty/NEWS?r1=1.503&r2=1.504&ty=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.503 smarty/NEWS:1.504
--- smarty/NEWS:1.503 Mon Jun 13 15:22:28 2005
+++ smarty/NEWS Fri Jul 8 09:36:33 2005
@@ -1,3 +1,5 @@
+ - add passthru attribute feature to html_select_date (kills,
+ monte)
- add "middle" parameter to truncate (monte)
- make form input label ids optional (monte)
- add error message for empty if/elseif statements (eykanal,
http://cvs.php.net/diff.php/smarty/libs/plugins/function.html_select_date.php?r1=1.31&r2=1.32&ty=u
Index: smarty/libs/plugins/function.html_select_date.php
diff -u smarty/libs/plugins/function.html_select_date.php:1.31 smarty/libs/plugins/function.html_select_date.php:1.32
--- smarty/libs/plugins/function.html_select_date.php:1.31 Thu Apr 7 14:11:24 2005
+++ smarty/libs/plugins/function.html_select_date.php Fri Jul 8 09:36:34 2005
@@ -34,6 +34,7 @@
*/
function smarty_function_html_select_date($params, &$smarty)
{
+ require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
require_once $smarty->_get_plugin_filepath('function','html_options');
/* Default values. */
@@ -78,6 +79,7 @@
$day_empty = null;
$month_empty = null;
$year_empty = null;
+ $extra_attrs = '';
foreach ($params as $_key=>$_value) {
switch ($_key) {
@@ -119,8 +121,12 @@
break;
default:
- $smarty->trigger_error("[html_select_date] unknown parameter $_key", E_USER_WARNING);
-
+ if(!is_array($_value)) {
+ $extra_attrs .= ' '.$_key.'="'.smarty_function_escape_special_chars($_value).'"';
+ } else {
+ $smarty->trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+ }
+ break;
}
}
@@ -194,7 +200,7 @@
if (null !== $all_extra){
$month_result .= ' ' . $all_extra;
}
- $month_result .= '>'."\n";
+ $month_result .= $extra_attrs . '>'."\n";
$month_result .= smarty_function_html_options(array('output' => $month_names,
'values' => $month_values,
@@ -230,7 +236,7 @@
if (null !== $day_extra){
$day_result .= ' ' . $day_extra;
}
- $day_result .= '>'."\n";
+ $day_result .= $extra_attrs . '>'."\n";
$day_result .= smarty_function_html_options(array('output' => $days,
'values' => $day_values,
'selected' => $time[2],
@@ -276,7 +282,7 @@
if (null !== $year_extra){
$year_result .= ' ' . $year_extra;
}
- $year_result .= '>'."\n";
+ $year_result .= $extra_attrs . '>'."\n";
$year_result .= smarty_function_html_options(array('output' => $years,
'values' => $yearvals,
'selected' => $time[0],
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php