Question

I created a custom extension for TYPO3 CMS. It basically does some database queries to get text from database. As I have seen, TYPO3 editor, transforms data before storing it in database so for example a link <a href="....." >Link</a> is stored as <link href>My Link Text</link> and so on for many tags like this. when I query data from DB, I get it as it is stored in DB (<link href>My Link Text</link>) so links are not displayed as they shoud. They display as normal text..

As far as I know there are two ways to go:

  1. disable RTE transformations (how to do that?)

  2. use lib.parseFunc_RTE (which i have no Idea how to configure it properly)

any idea? thanks.

Was it helpful?

Solution 4

Well, just so if anyone else runs into this problem,

I found one way to resolve it by using pi_RTEcssText() function inside my extension file:

$outputText=$this->pi_RTEcssText( $value['bodytext'] );

where $value['bodytext'] is the string I get from the database-query in my extension.

This function seems to process data and return the full HTML (links, paragraphs and other tags inculded).

Note: If you haven't already, it requires to include this file:

require_once(PATH_tslib.'class.tslib_pibase.php');

on the top of your extension file.

That's it basically.

OTHER TIPS

I guess you're not using Extbase and Fluid? Just as a reference, if you are using Extbase and Fluid for your extension you can render text from the RTE using Fluid:

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

This uses lib.parseFunc_RTE to render the RTE text as HTML. You can also tell it to use a different TypoScript object for the rendering:

<f:format.html parseFuncTSPath="lib.my_parseFunc">{bodytext}</f:format.html>

Useful documentation:

I came across the same problem, but using EXTBASE the function "pi_RTEcssText" ist not available anymore. Well maybe it is, but I didn't know how to include it.

Anyway, here's my solution using EXTBASE:

$this->cObj = $this->configurationManager->getContentObject();
$bodytext = $this->cObj->parseFunc($bodyTextFromDb, $GLOBALS['TSFE']->tmpl->setup['lib.']['parseFunc_RTE.']);

This way I get the RTE formatted text.

I have managed to do it by configuring the included typoscript:

# Creates persistent ParseFunc setup for non-HTML content. This is recommended to use (as a reference!)
lib.parseFunc {
makelinks = 1
makelinks.http.keep = {$styles.content.links.keep}
makelinks.http.extTarget < lib.parseTarget
makelinks.http.extTarget =
makelinks.http.extTarget.override = {$styles.content.links.extTarget}
makelinks.mailto.keep = path
tags {
    link = TEXT
    link {
        current = 1
        typolink.parameter.data = parameters : allParams
        typolink.extTarget < lib.parseTarget
        typolink.extTarget =
        typolink.extTarget.override = {$styles.content.links.extTarget}
        typolink.target < lib.parseTarget
        typolink.target =
        typolink.target.override = {$styles.content.links.target}
        parseFunc.constants =1
    }
}
allowTags = {$styles.content.links.allowTags}

And denied tag link:

denyTags = link

sword = <span class="csc-sword">|</span>
constants = 1

nonTypoTagStdWrap.HTMLparser = 1
nonTypoTagStdWrap.HTMLparser {
    keepNonMatchedTags = 1
    htmlSpecialChars = 2
}
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top