TYPO3 News Template Selektor
Page TSconfig
#News Templates tx_news { templateLayouts { 1 = Ohne Kat mit Tags 2 = Mit Kat und Tags 3 = Ohne Kat ohne Tags 4 = Ohne Tags and Date 5 = Startseite Bilder oben 6 = List ohne Bilder 7 = Detail ohne Bilder } }
Template List.html (Ausschnitt)
<!-- ohne Bilder für Termine --> <f:if condition="{settings.templateLayout} == 6"> <f:if condition="{settings.hidePagination}"> <f:then> <f:for each="{news}" as="newsItem" iteration="iterator"> <f:render partial="List/Item-noimage" arguments="{newsItem: newsItem,settings:settings,iterator:iterator}"/> </f:for> </f:then> <f:else> <f:if condition="{settings.list.paginate.insertAbove}"> <f:render partial="List/Pagination" arguments="{pagination: pagination.pagination, paginator: pagination.paginator}"/> </f:if> <f:for each="{pagination.paginator.paginatedItems}" as="newsItem" iteration="iterator"> <f:render partial="List/Item-noimage" arguments="{newsItem: newsItem,settings:settings,iterator:iterator}"/> </f:for> <f:if condition="{settings.list.paginate.insertBelow}"> <f:render partial="List/Pagination" arguments="{pagination: pagination.pagination, paginator: pagination.paginator}"/> </f:if> </f:else> </f:if> </f:if>
Partial Item-noimage.html
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:n="http://typo3.org/ns/GeorgRinger/News/ViewHelpers" data-namespace-typo3-fluid="true"> <!-- Partials/List/Item-noimage.html --> <div class="article articletype-{newsItem.type}{f:if(condition: newsItem.istopnews, then: ' topnews')}" itemscope="itemscope" itemtype="http://schema.org/Article"> <n:excludeDisplayedNews newsItem="{newsItem}"/> <!-- header --> <div class="header"> <h2> <n:link newsItem="{newsItem}" settings="{settings}" title="{newsItem.title}"> <span itemprop="headline">{newsItem.title}</span> </n:link> </h2> </div> <!-- teaser --> <div class="teaser-text"> <f:if condition="{newsItem.teaser}"> <f:then> <span itemprop="description teaser">{newsItem.teaser -> f:format.crop(maxCharacters: '{settings.cropMaxCharacters}', respectWordBoundaries:'1') -> f:format.html()}</span> </f:then> <f:else> <span itemprop="description">{newsItem.bodytext -> f:format.crop(maxCharacters: '{settings.cropMaxCharacters}', respectWordBoundaries:'1') -> f:format.html()}</span> </f:else> </f:if> </div> <div class="more-link"> <n:link newsItem="{newsItem}" settings="{settings}" class="more" title="{newsItem.title}"> <f:translate key="more-link"/> </n:link> </div> <!-- footer information --> <div class="footer"> <p> <!-- date --> <span class="news-list-date"> <time datetime="{f:format.date(date:newsItem.datetime, format:'Y-m-d')}"> <f:format.date format="{f:translate(key:'dateFormat')}">{newsItem.datetime}</f:format.date> <meta itemprop="datePublished" content="{f:format.date(date:newsItem.datetime, format:'Y-m-d')}"/> </time> </span> <f:if condition="{newsItem.categories}"> <div class="category-titletag"> <f:translate key="categories"/> </div> <!-- first category --> <span class="news-list-category" itemprop="keywords"> <f:for each="{newsItem.categories}" as="category"> <!--<f:link.action arguments="{overwriteDemand:{categories:category}}">{category.title}</f:link.action>--> <f:link.page pageUid="{settings.listPid}" additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category}}}">{category.title}<span class="tag-devider"> </span></f:link.page> </f:for> </span> </f:if> <f:if condition="{newsItem.tags}"> <div class="tag-titletag"> <f:translate key="tags"/> </div> <!-- Tags --> <span class="news-list-tags" itemprop="keywords"> <f:for each="{newsItem.tags}" as="tag"> <!--<f:link.page pageUid="{settings.listPid}" additionalParams="{tx_news_pi1:{overwriteDemand:{tags: tag}}}">{tag.title}</f:link.page>--> <f:link.action arguments="{overwriteDemand:{tags:tag}}">{tag.title}<span class="tag-devider"> </span></f:link.action> </f:for> </span> </f:if> <!-- author --> <f:if condition="{newsItem.author}"> <span class="news-list-author"> <f:translate key="author" arguments="{0:newsItem.author}"/> </span> </f:if> </p> </div> </div>
Template Detail.html (Ausschnitt)
<!--AHK 28.9.23 Detail ohne Bilder --> <f:if condition="{settings.templateLayout} == 7"> <f:then> <n:format.nothing> </n:format.nothing> </f:then> <f:else> <f:render partial="Detail/FalMediaContainer" arguments="{media: newsItem.media, settings:settings}"/> </f:else> </f:if>