LISE template / or general question
Posted: Tue Mar 19, 2024 9:56 am
Hi!
I do have a working solution - but I wonder, if this could have been accomplished quicker/shorter in code.
I wanted to write a "last updated on" (German date, which is bad to sort by) at the very end of the LISE items.
This is what I have so far and what does work:
If I only wrote {$highdate|date_format:'%d.%m.%Y'} the contents was wrong and the date was something in 1970. Hence all the substr and truncates.
I'd be glad to learn something - if you had the time to answer I'd appreciate it; again, this solution does the trick, so no biggie.
I do have a working solution - but I wonder, if this could have been accomplished quicker/shorter in code.
I wanted to write a "last updated on" (German date, which is bad to sort by) at the very end of the LISE items.
This is what I have so far and what does work:
Code: Select all
<p><small>Last updated: {foreach from=$items item=item}
{if !isset($highdate)}{assign highdate value=$item->modified_time|date_format:'%Y%m%d'}{/if}
{if ($item->modified_time|date_format:'%Y%m%d' > $highdate)}{assign highdate value=$item->modified_time|date_format:'%Y%m%d'}{/if}
{if $item@last}{$highdate|substr:-2}.{$highdate|substr:-4|truncate:2:''}.{$highdate|substr:-8|truncate:4:''}{/if}
{/foreach}</small></p>
I'd be glad to learn something - if you had the time to answer I'd appreciate it; again, this solution does the trick, so no biggie.
