【问题标题】:How to output COA_INT in fluid template form element如何在流体模板表单元素中输出 COA_INT
【发布时间】:2019-05-24 10:44:33
【问题描述】:

我想将扩展 GP 变量传递给我在插件之外构建的表单。尝试这样做时,我使用了 COA_INT,结果输出 <INT_SCRIPT. 而不是值。

为了做到这一点,我构建了这个打字稿对象:

lib.gpSWord = COA_INT
lib.gpSWord {
    # Protects from XSS!
    stdWrap.htmlSpecialChars = 1
    10 = TEXT
    10 {
        stdWrap.data = GP:tx_indexedsearch_pi2|search|sword
    }
}

然后尝试像这样输出它(建议here:

<f:form.textfield name="search[sword]" value="<f:format.raw>{f:cObject(typoscriptObjectPath: 'lib.gpSWord')}</f:format.raw>" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword font-h2" />

还尝试使用 f:variable 事先构建变量,但没有任何效果。

预期的结果是设置变量,然后将值传递给 form.textfield viewhelper,但显然这也不起作用。

【问题讨论】:

    标签: typo3 fluid extbase typo3-8.x typo3-9.x


    【解决方案1】:

    您应该在 Typoscript (setup) 中提交变量:

    page.10 = FLUIDTEMPLATE
    page.10.variables.gpSWord < lib.gpSWord
    

    然后您可以在 Fluidtemplate 中使用它:

    <f:format.raw>{gpSWord}</f:format.raw>
    

    【讨论】:

    • 不是和&lt;f:variable name="gpSword"&gt;&lt;f:format.raw&gt;{f:cObject(typoscriptObjectPath: 'lib.gpSWord')}&lt;/f:format.raw&gt;&lt;/f:variable&gt;一样吗
    • 我总是使用我推荐的方式,它就像一个魅力。我还在 Fluidtemplate 中使用了它: 也有效。但我推荐答案中的那个,因为它更清楚。
    【解决方案2】:
    lib.gpSWord = COA_INT
    lib.gpSWord {    
      stdWrap {
          wrap = &tx_indexedsearch_pi2[sword]=|
          data = GP:tx_indexedsearch_pi2|sword
          if.isTrue.data = GP:tx_indexedsearch_pi2|sword
        }
    }
    

    为 GP 试试这个。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-09
      • 2015-12-18
      • 2014-02-28
      • 1970-01-01
      相关资源
      最近更新 更多