2017-05-08 38 views
9

我正在使用TYPO3 7.6.11和indexed_search 7.6.0。索引在輸出中搜索extbase htmltags

我使用extbase插件進行indexed_search,並在輸出中轉義HTML標記以標記搜索詞。例如,當我搜索「搜索」我得到這個輸出:

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

我發現這個漏洞修復了這個問題:https://forge.typo3.org/issues/77901

但文件PageBrowsingResultsViewHelper.php看起來不完全一樣,甚至當我添加變量protected $escapeOutput = false;它不會改變任何東西。

任何想法,這是從哪裏來,我可以禁用轉義?

回答

3

這又是誰的擴展改寫偏tx_indexedsearch的導致問題.. - >經常檢查,如果你正在使用的模板是被輸出的一個;)

0

這會發生,因爲格式對象渲染你的結果將在{row.description}對象中呈現,並且最初沒有設置格式。您必須將結果({row.description})格式化爲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>