首页 文章

索引搜索输出中的extbase htmltags

提问于
浏览
8

我使用的是TYPO3 7.6.11和indexed_search 7.6.0 .

我为indexed_search使用extbase插件,在输出中它转义HTML-Tags以标记搜索词 . 例如,当我搜索“搜索”时,我得到这个输出:

Test text with<strong class="tx-indexedsearch-redMarkup">search</strong> pattern.

我发现了这个问题的错误修复:https://forge.typo3.org/issues/77901

但文件 PageBrowsingResultsViewHelper.php 看起来并不完全相同,即使我添加变量 protected $escapeOutput = false; 它也没有改变任何东西 .

知道这是从哪里来的,我可以在哪里禁用转义?

2 回答

  • 2

    这是另一个扩展,它覆盖了造成问题的tx_indexedsearch的部分内容 . - >始终检查您正在处理的模板是否是输出的模板;)

  • 0

    这是因为格式对象渲染 . 您的结果将在对象中呈现,并且最初没有格式集 . 您必须将结果()格式化为HTML . 为了那个原因:

    Go to the search result file.
    yourindexsearch/templatingpath/IndexedSearch/Partials/Searchresult.html
    

    这是完整的文件:

    <div class="fourffCom col-sm-6">
        <f:format.html><h2>{row.title}</h2></f:format.html>
    
        <f:if condition="{row.headerOnly} == 0">
            <!-- Format html -->
            <f:format.html>{row.description}</f:format.html>
            <ul>
                <li>
                    <p><f:translate key="result.size" />&nbsp;</p>
                    <b>{row.size}</b>
                </li>
                <li>
                    <p class="tx-indexedsearch-text-item-crdate"><f:translate key="result.created" />&nbsp;</p>
                    <b class="tx-indexedsearch-text-item-crdate"><f:format.date>@{row.created}</f:format.date></b>
                </li>
                <li>
                    <p class="tx-indexedsearch-text-item-mtime"><f:translate key="result.modified" />&nbsp;</p>
                    <b class="tx-indexedsearch-text-item-mtime"><f:format.date>@{row.modified}</f:format.date></b>
                </li>
                <li>
    
                </li>
                <li>
                    <p><f:translate key="result.path" />&nbsp;</p>
                    <b><f:format.html>{row.path}</f:format.html></b>
                </li>
            </ul>
        </f:if>
    
        <f:if condition="{row.headerOnly} == 1">
            <!-- Format html -->
            <f:format.html>{row.description}</f:format.html>
        </f:if>
    
        <f:if condition="{row.subresults}">
            <p class="tx-indexedsearch-list">
                <f:for each="{row.subresults.items}" as="subrow">
                    <f:render partial="Searchresult" arguments="{row: subrow}" />
                </f:for>
            </p>
        </f:if>
    </div>
    

相关问题