[TYPO3-english] Error using strftime and TSFE
Bartbogdan
bdubelaar at sundayafternoon.nl
Mon May 25 08:52:11 CEST 2009
Op 2009-05-24 19:40:34 +0200, zei "Christian Müller (Kitsunet)"
<christian at kitsunet.de>:
> Bartbogdan wrote:
>> Hi all,
>>
>> Using the following code:
>> 30 = TEXT
>> 30.data = TSFE:fe_user|user|date_of_birth
>> 30.strftime = %e %B %G
>>
>> PHP will throw the following error:
>> typo3 strftime() expects parameter 2 to be long
>>
>> How can I circumvent this error?
>> Apparantly the timestamp given by TSFE:fe_user|user|date_of_birth is a
>> string. So how can I make it such that is is converted to long?
>>
>> Best regards,
>>
>> Bart
>>
>>
>
> Maybe in tslib_cObj the content should be casted to integer, I will
> write a patch for that. You cannot do anything about it I think.
Thanks,
I solved it at the moment by writing a small php script and the
following typoscript:
Typoscript:
30 = USER
30 {
userFunc=user_parsedate->main
wrap1=<div class="myNiceDate">
wrap2=</div>
}
PHP script:
class user_parsedate {
var $cObj;
function main($content,$conf){
$birthdate = $GLOBALS['TSFE']->fe_user->user['date_of_birth'];
$nicedate = strftime("%e %B %G", (int)$birthdate);
$content = $conf['wrap1'].$nicedate.$conf['wrap2'];
return $content;
}
}
Best regards,
Bart
More information about the TYPO3-english
mailing list