Re: date format in Calendar
Hi justs,
you could try this solution. Although the tutorial relates to the news module, I guess the mentioned solution can be implemented in the template of the calendar module as well.
Re: date format in Calendar
Thanks xchs,
It's a good solution, but we're not quite there yet. I put it in the template like this:
Code:
<?php preg_match('/([0-9]{2}).([0-9]{1,2}).([0-9]{4})/',$this->date,$date); echo $date[1] . " " . $GLOBALS['TL_LANG']['MONTHS'][$date[2]-1] . " " . $date[3]; ?><?php if ($this->endDate): ?> - <?php preg_match('/([0-9]{2}).([0-9]{1,2}).([0-9]{4})/',$this->date,$date); echo $date[1] . " " . $GLOBALS['TL_LANG']['MONTHS'][$date[2]-1] . " " . $date[3]; ?><?php endif; ?>
And it works great for the first date (startDate), but the second date (endDate) is not displayed, instead the startDate is displayed there, which makes sense of course. I tried to change the variables in the preg_match statement to
Code:
$this->startDate,$date
and
Code:
$this->endDate,$date
but that broke the thing.
Any ideas?
This issue illustrates that I'm no PHP buff. Sorry about that, but I do think that it should be simpler to make changes to the way dates are formatted in the frontend. I made a feature request in the development forum.
Re: date format in Calendar
Hi justs,
by adding the following line
Code:
<pre><?php $this->showTemplateVars(); ?></pre>
at the beginning of your modified template you will see all template variables available for this module. Maybe you could there extract some useful information about your desired start and end dates...
Re: date format in Calendar
Thank you for replying, xchs. I know what the variables are (startDate and endDate), but I don't know where to put them in the preg_match statement or elsewhere to get the desired result...
Re: date format in Calendar
Aha, by change I discovered the right solution. As always, it's simpler than I thought:
Just call
Code:
$this->parseDate($format)
instead of
The answer is documented in the tutorial section of the dev website: http://dev.contao.org/projects/typol...ialsMonthNames.
It's a pity that these great tutorials are hidden so well...