I have a smarty template that has been working fine for me for some time but for reasons I don't quite understand one of the variables that I "assign" to the template is $activity_date and when I send in time information with my date information it has some surprising effects (aka, it works when "2012-12-27" is passed in but falls over in a bizzare way when "2012-12-27 00:00:00" is passed in.
It might make a little more sense if the problems actually were related to some sort of template interaction with this variable but it doesn't appear to be. Instead the end effect is that conditional statements like:
class="ajax-selector {if ($span)}span{$span}{/if} left"
produce the following error:
PHP Notice: Undefined index: span in /[PATH]/templates/compiled/96681eebf17717b8605c8deffb547d7e89c1ace6.file.select2-ajax.tmpl.php on line 35
To me this is quite paradoxical. The code says "test for the existance of $span" and then take action only if it does exist. The error message complains about an undefined index which was the intent of the conditional test.
As I said earlier, all of these types of conditional statements used to work exactly as you'd expect them to but they've all started failing and the only difference seems to be whether the "activity_date" comes back with time-level precision or just date-level precision.
In case it is helpful, here's the code that sets up the template:
public function handler ( $request ) {
$response = new stdClass();
$response->action = $request['action'];
$response->post_type = LG_TAX_Action()->post_type($response->action);
$response->meta = LG_TAX_Action()->meta ( $response->action );
$template = FE_Template::init();
$meta = new LG_Meta();
$template->assign ( 'form' , $response );
if ( isset ($request['activity_date']) ) {
$template->assign ( 'activity_date' , $request['activity_date'] );
}
$named_days = new stdClass();
$named_days->today = new DateTime('today');
$named_days->today = $named_days->today->format('Y-m-d');
$named_days->yesterday = new DateTime('yesterday');
$named_days->yesterday = $named_days->yesterday->format('Y-m-d');
$template->assign ( 'named_days' , $named_days );
$template->assign ( 'meta' , $meta ); // provides the "template_exists()" method
$response->template = $template->fetch( 'activity_forms/master.tmpl' );
return $response;
}