0
votes

I want to parse RTE content in TYPO3 6.2.9 extBase. I have tried:

$cObj = GeneralUtility::makeInstance('tslib_cObj');
$parseContent= $cObj->parseFunc($content, array(), '< lib.parseFunc_RTE');

$parseContent=\TYPO3\CMS\Frontend\Plugin\AbstractPlugin::pi_RTEcssText($content);

$cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
parseContent= $cObj->parseFunc($content, array(), '< lib.parseFunc_RTE' );

screenshot of the resulting html

How can I parse RTE content?

4
more details! where do you want to parse it ? within contorller, view? what exactly T3 are you using, you tagged with 6.2 but trying depraciated tslib_cObj... we can't guessbiesior
I have extend seminar ext. Some where I need to more functionality, so I made extBase extension named seminarsystem. here I need to resend email and template must be from seminar ext. so I need to parse RTE data in controller.Ghanshyam Gohel
sligthly improved code formatting: an empty line is sufficient to express the three tries, put the link in a more meaningful textFélix Adriyel Gagnon-Grenier
I got solution from here: stackoverflow.com/questions/12267124/… $parseObj = GeneralUtility::makeInstance('t3lib_parsehtml_proc'); $txt = $parseObj->TS_links_rte($bodytext); $seminarDescription = $parseObj->TS_transform_rte($txt); It's work for me!Ghanshyam Gohel
You should use a fluid template as your email template, you don't have to parse RTE content then.Arek van Schaijk

4 Answers

1
votes
$Cobj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tslib_cObj');
$htmloutput= $Cobj->parseFunc($myquerywithcontentvariable , array(), '< lib.parseFunc_RTE'); 

And of course Also use defaultExtras' => 'richtext:rte_transform[flag=rte_enabled|mode=ts_css] in your TCA file

1
votes

Here is the function for the same

private function formatHtml($value) {
        $contentObject = GeneralUtility::makeInstance(TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
        $content = $contentObject->parseFunc($value, array(), '< lib.parseFunc_RTE');
        return $content;
}
0
votes

Alongwith RTE option enableRichText="1" please append this option as well defaultExtras="richtext:rte_transform[flag=rte_enabled|mode=ts_css]"

This might help :)

0
votes
$parseProcObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
$parseProcObj->parseFunc($value, array(), '< lib.parseFunc_RTE')