【问题标题】:TYPO3 indexed_search rename placeholderTYPO3 indexed_search 重命名占位符
【发布时间】:2019-03-25 10:12:49
【问题描述】:

我尝试在 TYPO3 9.5.5 中重命名 indexed_search 占位符标签。

模板如下所示:

<f:form.textfield name="search[sword]" value="{sword}" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword form-control mr-sm-2 form-control-sm" placeholder="{f:translate(key: 'LLL:EXT:indexed_search/Resources/Private/Language/locallang.xml:form.submit')}" />

如何更改占位符的值?

我试过这个:

plugin.tx_indexed_search._LOCAL_LANG.default.form.submit = New Placeholder Text

还有这个:

plugin.tx_indexed_search.locallang.default.form.submit = New Placeholder Text

但两者都不起作用。

谢谢, 里梅

【问题讨论】:

    标签: typo3 typo3-9.x


    【解决方案1】:

    如果您将自定义扩展用于 FLUID 模板,请使用 &lt;f:translate key='form.submit' extensionName='your_extension_key'/&gt; 并在您的扩展程序中创建所有 lacallang 文件

    你可以找到下面的代码

    <f:form.textfield  name="search[sword]" value="{sword}" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword form-control" placeholder="{f:translate(key: 'form.submit', extensionName: 'your_extension_key')}"/>
    

    如果您使用的是 fileadmin base,那么您必须创建一个如下所示的打字稿对象

    lib.langFile=TEXT
    lib.langFile.value=LLL:EXT:indexed_search/Resources/Private/Language/locallang.xm
    [globalVar = GP:L = 1]
    lib.langFile.value=LLL:EXT:indexed_search/Resources/Private/Language/de.locallang.xml
    [end]
    

    您的代码将是

    <f:form.textfield name="search[sword]" value="{sword}" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword form-control mr-sm-2 form-control-sm" placeholder="<f:translate key='{f:cObject(typoscriptObjectPath: \'lib.langFile\')}:form.submit'/>" />
    

    我知道这很奇怪,但这是一个很好的解决方案!

    【讨论】:

    • 感谢您的回复,但我不想使用自定义扩展只是想重命名占位符。我不敢相信这个简单而完全常见的任务是typo3中的一个问题:D
    • 你用过哪种模板方法?
    【解决方案2】:

    试试这个:

    plugin.tx_indexedsearch._LOCAL_LANG.default.form.submit = New placeholder text
    

    这是德语:

    plugin.tx_indexedsearch._LOCAL_LANG.de.form.submit = New placeholder text
    

    【讨论】:

    • 感谢您的回复,但这不起作用。在 Typo3 9 中,索引搜索 9.5.5。用下划线重命名“tx_indexed_search”是正确的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多