【问题标题】:How can i customize Render content elements如何自定义渲染内容元素
【发布时间】:2022-07-05 20:34:58
【问题描述】:

使用 TS 变体,文章完全与媒体一起显示。如何使用自己的模板? 或者有没有办法将媒体传输到流体模板?

我将以下代码用于新闻->content element

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

在 TS 中:

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

如何在自己的模板中自定义渲染内容元素?

但是,本文档描述的是流体模板 有一个调试问题,我没有得到 media 的内容 https://docs.typo3.org/p/georgringer/news/main/en-us/Tutorials/Templates/RenderContentElements/Index.html

【问题讨论】:

    标签: css typo3 render customization


    【解决方案1】:

    您可以更改fluid_styled_content 的模板并根据记录的pid 添加一个条件,该记录将是保存新闻的sysfolder 之一。我猜这将是最简单的解决方案。

    【讨论】:

      【解决方案2】:

      original news extension detail template 媒体中是这样渲染的:

      <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>
      

      也许这可以解决您的问题。但是您必须通过将第一行添加到您的自定义模板来使 ViewHelper 可用:

      {namespace n=GeorgRinger\News\ViewHelpers}
      

      【讨论】:

        猜你喜欢
        • 2013-09-04
        • 2023-03-13
        • 2013-07-03
        • 1970-01-01
        • 2021-10-01
        • 2019-04-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多