1

IN TYPO3 versions before 7.6 it was possible to render links inside the content element HTML by using the TypoScript

tt_content.html.parseFunc.tags.link < lib.parseFunc.tags.link

This does not work anymore since 7.6. How can it be solved?

Georg Ringer
  • 7,779
  • 1
  • 16
  • 34

3 Answers3

2

If you use fluid_styled_content, override the HTML.html and want to use forms and have the Typo3 link tags <link>text</link> converted to html links, you will have to use this (at least this worked for me, both custom html forms were working and links were converted):

<f:format.htmlentitiesDecode>
    <f:format.html parseFuncTSPath="lib.parseFunc">
        {data.bodytext}
    </f:format.html>
</f:format.htmlentitiesDecode>
Shentao
  • 21
  • 1
  • 1
    With the solution above and the security fix (https://typo3.org/article/typo3-core-sa-2021-013) your html content might get changed by the sanitizer. To disable the sanitizer globally (not recommended) add this TypoScript config to your template `lib.parseFunc.htmlSanitize = 0` (see https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5.x/Important-94484-IntroduceHTMLSanitizer.html) – Ludwig Sep 09 '21 at 14:29
1

There are a couple of possible solutions for this question.

1.) Use fluid_styled_content.

I guess that now fluid_styled_content instead of css_styled_content is used. Therefore the used TypoScript does not work anymore. A valid solution would be to switch back to css_styled_content. However that is the old ancient way and for newer projects you shouldn't do this.

2.) Override the template of fluid_styled_content.

If you open the template of fluid_styled_content and the HTML element, found at typo3/sysext/fluid_styled_content/Resources/Private/Templates/Html.html you will see

<f:format.raw>{data.bodytext}</f:format.raw>

this must be changed to

<f:format.html>{data.bodytext}</f:format.html>

Overriding is described in the docs, see https://docs.typo3.org/typo3cms/extensions/fluid_styled_content/7.6/Configuration/OverridingFluidTemplates/Index.html

Georg Ringer
  • 7,779
  • 1
  • 16
  • 34
  • unfortunately this doens't work for me in Typo3 9.5.7, see here: https://stackoverflow.com/questions/56473965/rendered-links-in-html-element-in-typo3-9 – user838531 Jun 06 '19 at 08:48
  • UPDATE: the reason why I am having this problem, and why the above solution doesn't work, is that I am using a HTML-element in a powermail formular. Enabling rendering of typo3 links in HTML-elements does work as described above, but not in powermail formulars... – user838531 Jun 06 '19 at 11:34
0

Use the viewhelper f:link.typolink

Instead of using e.g.:

<a class="nav-link"
href="{contentElement.data.header_link}"
target="{contentElement.data.target}"
title="{contentElement.data.header}"
>

which will return something like t3://page?xxx as link use:

Basic example:

<f:link.typolink parameter="{contentElement.data.header_link}"> 
Linktext
</f:link.typolink>

See also viewhelper documentation for all parameters.

WDC
  • 1