karZten
karZten

Reputation: 31

How can i customize Render content elements

With the TS variant, the article is displayed completely with media. How can I use an own template? Or is there a way to transfer Media to Fluid template?

I use following code for News->content element

<f:if condition="{newsItem.contentElements}">
   <f:cObject typoscriptObjectPath="lib.tx_news.contentElementRendering">
</f:if>

In TS:

lib.tx_news.contentElementRendering = RECORDS
lib.tx_news.contentElementRendering {
  
         tables = tt_content
         source.current = 1
         dontCheckPid = 1

How can i customize Render content elements in a own template?

However, this documentation describes a fluid template with a debug issue I get no media for the content https://docs.typo3.org/p/georgringer/news/main/en-us/Tutorials/Templates/RenderContentElements/Index.html

Upvotes: 2

Views: 109

Answers (2)

Markus
Markus

Reputation: 101

In the original news extension detail template media is rendered like this:

<n:renderMedia news="{newsItem}" imgClass="img-responsive" videoClass="video-wrapper" audioClass="audio-wrapper">
    <f:if condition="{newsItem.teaser}">
        <!-- teaser -->
        <div class="teaser-text" itemprop="description">
            <f:format.html>{newsItem.teaser}</f:format.html>
        </div>
    </f:if>

    <f:if condition="{newsItem.contentElements}">
        <!-- content elements -->
        <f:cObject typoscriptObjectPath="lib.tx_news.contentElementRendering">{newsItem.contentElementIdList}</f:cObject>
    </f:if>

    <f:render partial="Detail/MediaContainer" arguments="{media: newsItem.mediaNonPreviews, settings:settings}" />

    <!-- main text -->
    <div class="news-text-wrap" itemprop="articleBody">
        <f:format.html>{newsItem.bodytext}</f:format.html>
    </div>
</n:renderMedia>

Maybe this can solve your problem. But you will have to make the ViewHelper available by adding this first line to your custom template:

{namespace n=GeorgRinger\News\ViewHelpers}

Upvotes: 1

Georg Ringer
Georg Ringer

Reputation: 7939

You could change the templates of fluid_styled_content and add a condition based on the pid of the record which would be the one of the sysfolder where the news is saved. that would be the easiest solution I guess.

Upvotes: 1

Related Questions