0

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?

Ghanshyam Gohel
  • 1,264
  • 1
  • 17
  • 27
  • 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 guess – biesior Mar 03 '15 at 22:58
  • 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 Mar 05 '15 at 14:14
  • sligthly improved code formatting: an empty line is sufficient to express the three tries, put the link in a more meaningful text – Félix Adriyel Gagnon-Grenier Mar 05 '15 at 21:01
  • I got solution from here: http://stackoverflow.com/questions/12267124/php-script-is-parsing-content-from-rte-tt-news-but-internal-links-are-not-appe $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 Mar 09 '15 at 22:33
  • You should use a fluid template as your email template, you don't have to parse RTE content then. – Arek van Schaijk Apr 06 '15 at 00:34

4 Answers4

1
$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

vijay rami
  • 535
  • 4
  • 19
1

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;
}
Mihir Bhatt
  • 3,019
  • 2
  • 37
  • 41
0

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
$parseProcObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
$parseProcObj->parseFunc($value, array(), '< lib.parseFunc_RTE')
Clay Sissing
  • 224
  • 2
  • 4
  • The community encourages adding explanations alongisde code, rather than purely code-based answers (see [here](https://meta.stackoverflow.com/questions/300837/what-comment-should-i-add-to-code-only-answers)). – costaparas Feb 14 '21 at 04:54