Blog Sections Open
Formatting TV Date Fields Without Time in DocLister
A DocLister guide for showing TV dates as day-month-year output without exposing the raw timestamp or time portion stored by the manager widget.
Date TVs often store a full datetime value even when editors think they are selecting only a date. That is why a clean manager field can still render as 27-04-2019 13:08:00 in a DocLister template.
The original example
[!DocLister?
&tvList=`startdate,enddate,sity,country`
&tpl=`@CODE:<td>[+tv.startdate+]</td>`
&dateSource=`tv.startdate`
&dateFormat=`%d %b %Y`
!]
Why the raw value still appears
[+tv.startdate+] prints the raw TV value. The &dateSource setting affects DocLister date helpers, but it does not automatically reformat every raw TV placeholder.
Better options
- format the value in a custom
preparestep - use a dedicated formatted placeholder in the template
- normalize the TV value before output if your project reuses the same date field often
&prepare=`formatEventDates`
// inside prepare
$data['startdate_formatted'] = strftime('%d %b %Y', strtotime($data['tv.startdate']));
return $data;
Then in the template:
[+startdate_formatted+]
Manager-side note
If the input widget still forces a time picker, that is a UI issue, not a DocLister issue. You may want to replace the TV input component or hide the time selector in the manager, but output formatting should still happen explicitly.
FastRoute-Based Custom Routing in Evolution CMS 2.0
A guide-oriented post about custom routing in Evolution CMS 2.0 using FastRoute ideas inside the example-package workflow.
Filtering DocLister Results by a TV-Based Section Map
A cleaner way to build DocLister selections when resources point to sections through a TV instead of using deeply nested inline DocLister calls.