html_select_date [NEW_PATCH]
[email protected] ("Nicklas Bondesson") Tue, 5 Jul 2005 12:05:01 +0200
| Newsgroups | php.smarty.dev |
|---|---|
| Message-ID | <[email protected]> |
Here's a new patch that works with the time attribute. If you provide a variable with an empty value it defaults back to current time. Nicklas
function.html_select_date.php_20050705_1200.diff.txt
(text/plain, 487 B)
--- function.html_select_date.php.orig 2005-07-05 12:08:43.000000000 +0200
+++ function.html_select_date.php 2005-07-05 12:09:23.000000000 +0200
@@ -124,6 +124,12 @@
}
}
+ // Check for empty time attribute
+ // If empty, default back to current time
+ if (!preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $time)) {
+ $time = time();
+ }
+
if(preg_match('!^-\d+$!',$time)) {
// negative timestamp, use date()
$time = date('Y-m-d',$time);