Zum Inhalt springen

News system (tx_news)

The tx_news extension is very complex and flexible, so you should take a closer look at the manual. Below we show a few adjustments that we have made in the course of our work with tx_news.

Output audio files in the frontend

In addition to images and videos, audio files can also be added editorially in the backend under the Relations tab. These are not displayed in the output by default. It is necessary to customize partials and add another one.

1. refer to the individual partial directory in the TypoScript instead of that of the extension.

2. create a new file "MediaAudio.html" with the following code and place it below your own partial directory: .../Partials/Detail/MediaAudio.html

<div class="mediaelement" xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">
  <div class="mediaelement-audio">
    <f:media class="audio-embed-item" file="{mediaElement}" alt="{mediaElement.originalResource.properties.alternative}" title="{mediaElement.originalResource.properties.title}"/>
  </div>
  <f:if condition="{mediaElement.description}">
    <div class="medialement-alternative-content">
      <p class="news-img-caption">
        {mediaElement.description}
      </p>
    </div>
  </f:if>
</div>

3. copy the files Partials/List/Item.html and Partials/Detail/MediaContainer.html into your individual directories and adapt them by referring to this partial file "MediaAudio.html".

Audio files are file type 3.

...
     <div class="news-img-wrap">
        <n:link newsItem="{newsItem}" settings="{settings}" title="{newsItem.title}">
          <f:alias map="{mediaElement: '{newsItem.mediaPreviews.0}'}">
            ...
            <f:if condition="{mediaElement.originalResource.type} == 3">
              <f:render partial="Detail/MediaAudio" arguments="{mediaElement: mediaElement}"/>
            </f:if>
            ...
          </f:alias>
        </n:link>
      </div>
...

This page contains automatically translated content.

Updated: 17.07.2024