Results 1 to 6 of 6

Thread: format timestamp in 'headerFields'

  1. #1
    User
    Join Date
    11-23-09.
    Location
    Valais, Switzerland
    Posts
    77

    Default format timestamp in 'headerFields'

    Hello,

    I have some headerFields that I display very well. My only problem is that I have a unixtimestamp that I whant to display as hour and minutes (like 13:05), but my_timestamp is displayed as "unixtimestamp" so just an integer.

    How and where can I format "my_timestamp" to Date? It is normally simple like
    Code:
     date("H:m",$my_timestamp)
    but I don't know where to write this code. I try to use "group_callback"(http://www.typolight.org/callbacks.html) but it will be working only in version 2.8 of Typolight !


    Code:
     // List
    'list' => array
    (
    'sorting' => array
    (
    'mode' => 4,
    'fields' => array('is_ok'),
    'headerFields' => array('my_description', 'my_timestamp''),
    'flag' => 5,
    'panelLayout' => 'sort,search,limit',
    'child_record_callback' => array('tl_test', 'list_test')
    ),
    Thanks for help

  2. #2
    User Toflar's Avatar
    Join Date
    06-19-09.
    Location
    Lyss, Switzerland
    Posts
    170

    Default Re: format timestamp in 'headerFields'

    There was a ticket about this. I'm sorry for you but you will need to update to 2.8 anyway because it'll be fixed as from 2.8 on only...

    Ticket: http://dev.typolight.org/issues/show/1540
    Revision: http://dev.typolight.org/repositories/r ... olight/169
    Regards

    Yanick - Contao core developer @terminal42 gmbh

  3. #3
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: format timestamp in 'headerFields'

    This is easily fixed. Just add an entry into your ['fields'] array for 'tstamp'. You can specify the eval option to be date formatted and also the label to be used. Just DO NOT specify the inputType, otherwise it can become editable with a control. That's all you need. TL will take the value and format it using your spec. You can do this with any field you haven't actually allowed for editing, e.g. PID, ID, etc...

  4. #4
    User
    Join Date
    11-23-09.
    Location
    Valais, Switzerland
    Posts
    77

    Default Re: format timestamp in 'headerFields'

    yes we ask the modification for 2.8, it is ok now!

    ticket closed

  5. #5
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: format timestamp in 'headerFields'

    yes, but my description works for installations pre-2.8 as well.

  6. #6
    User
    Join Date
    11-23-09.
    Location
    Valais, Switzerland
    Posts
    77

    Default Re: format timestamp in 'headerFields'

    yes thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •