[TYPO3-ttnews] SOLVED Numeric month without leading zero

Tomas Mrozek mail at cascaval.com
Thu May 4 18:33:18 CEST 2006


> I would like to display news date in the format 1-1-2006, that is 
> numeric day and month without leading zero.

Just in case someone faces the same problem in the future, here is the 
solution:

1. Create your own PHP script:
------------------------------------------------------------------
class user_myClass {
   // My date formatting function
   function myDateFunction($content, $conf) {
     $timestamp = $content;   // UNIX timestamp of the news article
     $output = [insert your code that would create the date];
     return $output;
   }
}
------------------------------------------------------------------

2. Include the script in the setup of your template:
page.includeLibs.myOwnScript = [path to your script]

3. Configure tt_news:
plugin.tt_news {
   displayList.date_stdWrap.strftime = %s
   displayList.date_stdWrap.postUserFunc = user_myClass->myDateFunction
   displaySingle.date_stdWrap.strftime = %s
   displaySingle.date_stdWrap.postUserFunc = user_myClass->myDateFunction
}

*Note*: you can pass some params to your function with...

displayList.date_stdWrap.postUserFunc.myParam =

...and access it by...

$conf['myParam']


Tomas Mrozek



More information about the TYPO3-project-tt-news mailing list