fix?
| From: | SP | Date: | Sat, 15 Jun 2002 19:02:51 +0000 |
| Subject: | fix? | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-4877@lists.php.net to get a copy of this message | ||
I have smarty 2.1.1.
When I ran the demo (http://www.phpinsider.com/php/code/Smarty/demo/) that
came with smarty, everything worked but I am getting this error:
Warning: Undefined variable: time in c:\program files\apache
group\apache\htdocs\cms\smarty-2.1.1\plugins\function.html_select_date.php
on line 59
Warning: Undefined variable: time in c:\program files\apache
group\apache\htdocs\cms\smarty-2.1.1\plugins\function.html_select_date.php
on line 63
I think the problem is that I make php show all errors. I added $time='' to
initialize the variable first and the error is gone. Is this how you guys
would fix this?
$time = ''; // added this line
// If $time is not in format yyyy-mm-dd
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $time)) {
// then $time is empty or unix timestamp or mysql timestamp
// using smarty_make_timestamp to get an unix timestamp and
// strftime to make yyyy-mm-dd
$time = strftime('%Y-%m-%d', smarty_make_timestamp($time));
}