I want to conditionally assign some values in the Add page: Before display event. I have used this in the 4.2 version and it worked great.
A working sample code in v4.2:
if (date("d")<10)
$smarty->assign("value_Total", 100.00);
else
$smarty->assign("value_Total", 125.00);
When I opened the project in v5.0 (tried a few builds including the latest 766), the code is change to this ($smarty replaced with $xt):
if (date("d")<10)
$xt->assign("value_Total", 100.00);
else
$xt->assign("value_Total", 125.00);
When I ran the application, it gave an error message: Undefined variable xt. I then added "global $xt;" at the beginning of the event page. Now when I ran the application again, I got no error message, but the code doesn't do anything. I also tried to modify the code to:
$xt->assign("Total_value", 100.00);
or
$xt->assign("Total", 100.00);
but nothing works. I am not sure what I did wrong with it. Please help. Thanks.