duan2428
2018-04-09 17:02
浏览 36
已采纳

Typo3 8.7.x / Extbase / Typoscript:如何在使用RECORDS时删除锚点包裹

I'm using an extension template for json output. I want to get the record by 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
  }
}

But my output has an anchor link before the data I want:

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

How to remove the

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

图片转代码服务由CSDN问答提供 功能建议

我正在使用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 
} 
} 
   
 
 

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

 &lt; a id =“c2”&gt;&lt; / a&gt;  ; {“errors”:[],“messages”:[“some message”]} 
   
 
 

如何删除 < pre> &lt; a id =“c2”&gt;&lt; / a&gt;

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doujie3888 2018-04-10 08:35
    已采纳

    Thanks @Bernd Wilke, now it's working with the following code

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

    When I'm right, with this code, it takes the content from the page from the page where the ext Template is defined and copies the rendering from the plugin. The uncommented code is not working because it's not using the content from the page where I inserted my plugin with the defined storage.

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • dongxun4110 2018-04-10 05:21

    If you use the RECORDS object you will get the default rendering of the records. And for tt_content that might include the anchor which is wrapped before for each element.

    If you want your own rendering you can use a CONTENT object with your own renderObj property.

    Or you modify the global rendering of tt_content records (either in typoscript for CSC or in the fluid layout file for FSC) to skip the anchor for pagetype 99.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题