Page 1 of 1
Posted:
Mon Aug 27, 2007 7:25 am
by yusif
Hi Steve,
Thanks for the suggested solution to my previous post. Setting the error_reporting... parameter in the php.ini solved the problem. The problem I have now is that when I go to the view tab I get errors like the following
Warning: Invalid CRT parameters detected in C:\Program Files\Apache Group\Apache2\htdocs\adsl\dataface\dataface-public-api.php on line 334 Warning: Invalid CRT parameters detected in C:\Program Files\Apache Group\Apache2\htdocs\adsl\dataface\dataface-public-api.php on line 334 Warning: Invalid CRT parameters detected in C:\Program Files\Apache Group\Apache2\htdocs\adsl\dataface\dataface-public-api.php on line 334 Warning: Invalid CRT parameters detected in C:\Program Files\Apache Group\Apache2\htdocs\adsl\dataface\dataface-public-api.php on line 334 Warning: Invalid CRT parameters detected in C:\Program Files\Apache Group\Apache2\htdocs\adsl\dataface\dataface-public-api.php on line 334 Warning: Invalid
Anymore suggestions ?
Thanks in advance.
Regards
Yusif
Posted:
Mon Aug 27, 2007 10:25 am
by shannah
What is on line 334 of dataface-public-api.php? (can you post the function around that area and specify which line is 334)?
-Steve
Posted:
Tue Aug 28, 2007 5:10 am
by yusif
the function is as shown below
function df_offset($date){
$date = strtotime($date);
$offset = (strftime("%j")+strftime("%Y")*365)-
(strftime("%j",$date)+strftime("%Y",$date)*365);
if ($offset>7){
$offset = (strftime("%V")+strftime("%Y")*52)- // THIS IS THE LINE 334
(strftime("%V",$date)+strftime("%Y",$date)*52);
$end=($offset!=0?($offset>1?$offset . " weeks ago":"a week ago"):"Today");
} else
$end=($offset!=0?($offset>1?"$offset days ago":"Yesterday"):"Today");
return strftime("%A, %B %e, %Y",$date)." - ". $end;
}
regards
Yusif
Posted:
Tue Aug 28, 2007 10:03 am
by shannah
Thanks for posting this. It seems that windows PHP doesn't support the %V parameter for the strftime method. Please change the two instances of '%V' to '%W' in this function.
e.g.
Instead of
$offset = (strftime("%V")+strftime("%Y")*52)- // THIS IS THE LINE 334
(strftime("%V",$date)+strftime("%Y",$date)*52);
You have
$offset = (strftime("%W")+strftime("%Y")*52)- // THIS IS THE LINE 334
(strftime("%W",$date)+strftime("%Y",$date)*52);
This should get rid of the errors.
-Steve
Posted:
Thu Aug 30, 2007 10:24 am
by yusif
Hi Steve,
Thanks for that, it indeed got rid of the error, however, a similar one appeared few lines below i.e. 339. I did not include those messages in my previous post. After correcting the above one, the error that appears yet to be cleared is below
Warning: Invalid CRT parameters detected in C:\Program Files\Apache Group\Apache2\htdocs\adsl\dataface\dataface-public-api.php on line 339 Warning: Invalid CRT parameters detected in C:\Program Files\Apache Group\Apache2\htdocs\adsl\dataface\dataface-public-api.php on line 339 Warning: Invalid CRT parameters detected in C:\Program Files\Apache Group\Apache2\htdocs\adsl\dataface\dataface-public-api.php on line 339 Warning: Invalid CRT parameters detected in C:\Program Files\Apache Group\Apache2\htdocs\adsl\dataface\dataface-public-api.php on line 339 Warning: Invalid CRT parameters detected in C:\Program Files\Apache Group\Apache2\htdocs\adsl\dataface\dataface-public-api.php on line 339
the funtion is again below
function df_offset($date){
$date = strtotime($date);
$offset = (strftime("%j")+strftime("%Y")*365)-
(strftime("%j",$date)+strftime("%Y",$date)*365);
if ($offset>7){
$offset = (strftime("%W")+strftime("%Y")*52)-
(strftime("%W",$date)+strftime("%Y",$date)*52);
$end=($offset!=0?($offset>1?$offset . " weeks ago":"a week ago"):"Today");
} else
$end=($offset!=0?($offset>1?"$offset days ago":"Yesterday"):"Today");
return strftime("%A, %B %e, %Y",$date)." - ". $end; // LINE 39
}
Posted:
Thu Aug 30, 2007 3:17 pm
by shannah
Evidently on Windows the %e parameter is unsupported also.Ê The %d parameter does almost the same thing and is supported on windows.
i.e. change
return strftime("%A, %B %e, %Y",$date)." - ". $end;
to
return strftime("%A, %B %d, %Y",$date)." - ". $end;
References:
http://php.net/strftime
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_strftime.2c_.wcsftime.asp