【问题标题】:Typo3 8.7.x / Extbase / Typoscript: How to remove the anchor wrap when using RECORDSTypo3 8.7.x / Extbase / Typoscript:使用 RECORDS 时如何移除锚定包装
【发布时间】:2018-04-09 17:02:53
【问题描述】:

我正在为 json 输出使用扩展模板。我想通过id获取记录。

ajax = PAGE
ajax {
  typeNum = 99
  config {
    disableAllHeaderCode = 1
    additionalHeaders = Content-type:application/json
    admPanel = 0
    debug = 0
  }
  10 = RECORDS
  10 {
    tables = tt_content
    source = 77
  }
}

但我的输出在我想要的数据之前有一个锚链接:

<a id="c2"></a>{"errors":[],"messages":["some message"]}

如何删除

<a id="c2"></a>

【问题讨论】:

    标签: php typo3 typoscript fluid extbase


    【解决方案1】:

    如果您使用RECORDS 对象,您将获得记录的默认呈现。对于 tt_content 可能包括之前为每个元素包装的锚点。

    如果您想要自己的渲染,您可以使用带有您自己的 renderObj 属性的 CONTENT 对象。

    或者您修改 tt_content 记录的全局呈现(在 CSC 的排版或 FSC 的流体布局文件中)以跳过页面类型 99 的锚。

    【讨论】:

    • 好的,谢谢,我会试试的。首先我必须弄清楚如何使用 CONTENT 和 renderObj 获取我的插件内容,因为内容来自我的插件。
    • 通常您可以在tt_content.&lt;CType&gt;plugins.&lt;list_type&gt; 找到渲染配置,您可以将其复制到renderObj - 然后修改。
    【解决方案2】:

    感谢@Bernd Wilke, 现在它正在使用以下代码

    ajax = PAGE
    ajax {
      typeNum = 99
      config {
        disableAllHeaderCode = 1
        additionalHeaders = Content-type:application/json
        admPanel = 0
        debug = 0
      }
      //not working, because it's not respect the storage
      #10 < tt_content.list.20.myext_p1
      10 = CONTENT
      10 {
        table = tt_content   
        renderObj = COA
        renderObj {
          10 < tt_content.list.20.myext_p1
        }
      }
    }
    

    如果我是对的,使用此代码,它会从定义了 ext 模板的页面中获取页面中的内容,并从插件复制渲染。未注释的代码不起作用,因为它没有使用我插入带有定义存储的插件的页面中的内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-13
      相关资源
      最近更新 更多