1

I have saved TYPO3 text (bodytext) in database. It contains different links saved in t3 format:

<p><a href="t3://page?uid=700" target="_blank" class="internal" title="title">Link</a> more text.</p>

The idea is create some script as CommandController, get this saved text and send it via email by cron. The problem is links will not be converted in proper html without frontend environment (it works fine, if I do the same inside frontend plugin).

I tried to render this text with fluid html view helper:

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

Also tried to parse text with $contentObject->parseFunc directly inside my CommandController. But it will just cut off link.

Is any simple TYPO3 function to convert bodytext in real html?

Note: typo3 version 8.7.16

Respant
  • 198
  • 1
  • 11

1 Answers1

0

Okay, It seems links are not being parsed and I don't think it's an issue with CommandController. I had same issue and found several ways to fix this issue.

Issue with EXT: frontend_editing

After uninstalling every non-vital extension and clearing every possible cache and a few hours of debugging we have found the problem: the "frontend_editing" extension - only if the user is logged in into the backend!

Issue at GitHub

  • Same issue discussed on Github, you can check it out here

@csba described detailed answer here!

Issue with EXR:fluid_styled_content

Another issue is with format viewhelper, @georg-ringer has explained solution for fixing issue and it works for me. Check it out here for more detail.

As per @georg-ringer answer, you can just change <f:format.html>{item.bodytext}</f:format.html> to <f:format.raw>{item.bodytext}</f:format.raw>. Probably this will fix your problem.

Extbase parse with link service.

// use TYPO3\CMS\Core\LinkHandling\LinkService;
$linkService = GeneralUtility::makeInstance(LinkService::class);
$linkDetails = $linkService->resolve($firstparameter);

You can parse link as shown above, you can find the reference below:

Geee
  • 2,217
  • 15
  • 30
  • I tried f:format.raw, it will just display links t3://page?uid=700 without converting them to real links (not cut off them like f:format.html does). I also checked frontend_editing question, the problem is it works fine in frontend plugin, doesn't work in CommandController (without real frontend environment). – Respant Feb 16 '21 at 09:40
  • Added `Extbase parse with link service.` to parse URL in the answer, did you tried this? – Geee Feb 16 '21 at 10:27
  • It just split up a link on the parts and returns an array. First you need find all such links in text and even after that It will not convert t3://page?uid=700 to real url – Respant Feb 18 '21 at 07:05