Got Errors in the view tab

A place for users and developers of the Xataface to discuss and receive support.

Postby yusif » Mon Aug 27, 2007 7:25 am

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
yusif
 
Posts: 28
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Mon Aug 27, 2007 10:25 am

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby yusif » Tue Aug 28, 2007 5:10 am

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
yusif
 
Posts: 28
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Tue Aug 28, 2007 10:03 am

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby yusif » Thu Aug 30, 2007 10:24 am

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
}
yusif
 
Posts: 28
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Thu Aug 30, 2007 3:17 pm

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

--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 31 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved