[TYPO3-Solr] TYPO3 6.2.15 & Solr: problem with htmlSpecialChars in links
Jigal van Hemert
jigal.van.hemert at typo3.org
Mon Nov 9 11:47:30 CET 2015
Hi,
On 08/11/2015 18:25, Bert Hiddink [BENDOO e-work solutions] wrote:
> Using TYPO3 6.2.15, Solr 3.0.2, tika 2.0.0-dev and solrfal 2.0.1
>
> With the following snippet, I want to prepend every link with an icon,
> according its type:
>
> plugin.tx_solr.search.results.fieldRenderingInstructions {
> title = TEXT
> title {
> field = title
> htmlSpecialChars =1
> htmlSpecialChars.preserveEntities =1
>
> prepend = CASE
> prepend {
> key.field = type
>
> pages = TEXT
> pages.value = <img
> src="fileadmin/images/icons/page-icon.png" />
>
> tx_solr_file = TEXT
> tx_solr_file.value = <img
> src="fileadmin/images/icons/pdf-icon.png" />
> }
> }
> }
>
> However, htmlSpecialChars.preserveEntities =1 does not respect the "<"
> and "/>" tags, these are rendered as "<" and "/>" respectively.
>
> What is wrong here? Any suggestions? Thanks in advance!
Nothing is wrong here. htmlSpecialChars is doing exactly what it's
supposed to do (converting &, ', ", < and > to HTML entities). The
option 'preserveEntities' will prevent double encoding (otherwise '
would be encoded to "#39).
In your case it might be easier to implement the icons in the template.
You can use some ###IF### markers to insert the icons with certain
document types.
Otherwise you'd have to turn 'title' into a COA, make your CASE the
first part en set the title field (with htmlSpecialChars) to the second
part.
title = COA
title {
10 = CASE
10 {
key.field = type
...
20 = TEXT
20 {
field = title
htmlSpecialChars = 1
htmlSpecialChars.preserveEntities = 1
}
}
--
Jigal van Hemert
TYPO3 CMS Active Contributor
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the TYPO3-project-solr
mailing list