Problem with time param of html_select_date (?)
| From: | shooz | Date: | Thu, 24 Oct 2002 03:19:05 +0000 |
| Subject: | Problem with time param of html_select_date (?) | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6224@lists.php.net to get a copy of this message | ||
Hi folks --
I just started out with PHP and Smarty, so this might be something I'm doing
wrong, but I am having difficulty with sending the time to the
html_select_date template function. I am using mysql_fetch_assoc() to fetch
a row from my MySQL database that contains a datetime that I explicitly
formatted to YYYYMMDDHHMMSS. I assign the array to smarty, and then call my
template:
PHP:
$result = mysql_query("select *, DATE_FORMAT(event_dt, '%Y%m%d%H%i%s') as
event_dt_timestamp from lc_events where event_id = $id");
$event = mysql_fetch_assoc($result);
$smarty->assign("event", $event);
$smarty->display("event_edit.tpl.html");
Template:
<!--{html_select_date time="$event.event_dt_timestamp"}-->
This does not work. Doing some investegating show that the
smarty_make_timestamp() function falls though to the part were it tries to
cast the string to an int.
If I pass the timestamp separately:
PHP:
$result = mysql_query("select *, DATE_FORMAT(event_dt, '%Y%m%d%H%i%s') as
event_dt_timestamp from lc_events where event_id = $id");
$event = mysql_fetch_assoc($result);
$smarty->assign("event", $event);
$smarty->assign("date", $event["event_dt_timestamp"]); ### pass it
separately
$smarty->display("event_edit.tpl.html");
Template:
<!--{html_select_date time="$date"}-->
This works fine. I don't know PHP well enough to understand why this
dosen't work... but in my debugging, I put a print "$string"; at the top of
the smarty_make_timestamp function, and it printed
"Array.event_dt_timestamp" and not the date.
thanks for any help,
shooz