Indexed Search extbase htmltags in output

时光怂恿深爱的人放手 提交于 2020-02-03 04:19:29

问题


I am using TYPO3 7.6.11 and indexed_search 7.6.0.

I use the extbase plugin for indexed_search and in the output it escapes the HTML-Tags to mark the searchword. For example, when I search for "search" I get this output:

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

I found this bugfix to this problem: https://forge.typo3.org/issues/77901

But the file PageBrowsingResultsViewHelper.php doesn't look exactly the same, and even when I add the variable protected $escapeOutput = false; it doesn't change anything.

Any idea where this is come from and where I can disable the escaping?


回答1:


It was another extension who overwrote a Partial of tx_indexedsearch that caused the problem.. -> Always check if the template you are working on is the one that gets outputted ;)




回答2:


This happen because of format object rendering.your result will render in {row.description} object and initially there is no format set. you have to format your result({row.description}) to the HTML. For that:

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

Here is the complete file:

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


来源:https://stackoverflow.com/questions/43848632/indexed-search-extbase-htmltags-in-output

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!