Last active
February 22, 2016 16:18
-
-
Save magicHatOfTYPO3/07f577f758edb969092b to your computer and use it in GitHub Desktop.
VHS - Altersberechnung bei tx_news
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div xmlns="http://www.w3.org/1999/xhtml" lang="en" | |
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers" | |
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers" | |
xmlns:n="http://typo3.org/ns/GeorgRinger\News\ViewHelpers" | |
v:schemaLocation="http://fluidtypo3.org/schemas/vhs-1.8.5.xsd"> | |
... | |
<!-- Auswahl des passenden Bildes anhand des Alters der News --> | |
<v:variable.set name="picture" value="Grafik 1 (< 7 Tage)" /> | |
<v:variable.set name="age">{v:math.subtract(a:'{v:system.timestamp()}',b:'{newsItem.datetime -> f:format.date(format:"U")}')}</v:variable.set> | |
<f:comment>Älter als 7 Tage?</f:comment> | |
<f:if condition="{age} > 604800"> | |
<v:variable.set name="picture" value="Grafik 2 (> 7 Tage)" /> | |
</f:if> | |
<f:comment>Älter als 30 Tage?</f:comment> | |
<f:if condition="{age} > 2592000"> | |
<v:variable.set name="picture" value="Grafik 3 (> 30 Tage)" /> | |
</f:if> | |
<!-- Ende der Auswahl: Bild steht nun in der Variable {picture} zur Verfügung --> | |
{picture} | |
... | |
</div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment