[TYPO3] TSref help: lookin up a DB field and using strftime

Vincent Caron vcaron at bearstech.com
Thu Jan 5 11:35:04 CET 2006


Hello,

  I'm using Typo 3.8.1. I have built a simple extension (key: tx_myext),
which among other things extends the 'page' table with a few custom
fields, such as 'introduction' and 'publish_date' (which is really not
crdate in my case). So far I can easily edit them in the page header,
and fetch those new fields values for a Templavoila template, with this
TS setup:

  lib.contentintroduction = TEXT
  lib.contentintroduction.value = {page:tx_myext_introduction}
  lib.contentintroduction.insertData = 1

  Then I would like to print my new publish_date field, which was
obviously created as a date type from the kickstarter, and ends up being
stored as an EPOCH timestamp (integer) in the DB. With the snippet
above, the date is rendered as a plain integer. Then I try this:

  lib.contentpublishingdate = TEXT
  lib.contentpublishingdate.value = {page:tx_myext_publish_date}
  lib.contentpublishingdate.strftime = %d-%m-%Y
  lib.contentpublishingdate.insertData = 1

  The display shows "01-01-1970". As far as I could grep from the code,
it looks like the {page:tx_myext_publish_date} lookup is only executed
later, and the .strftime function only sees something empty (ie. 0).

  I guess Typo3 has its reasons to store dates as integers in MySQL, so
I didn't try to switch to the native DATE or DATETIME SQL type. I'm a
bit locked, does anyone has a clue to help me ? Thanks !





More information about the TYPO3-english mailing list