Reputation: 198
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
Upvotes: 1
Views: 1337
Reputation: 2249
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.
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!
@csba described detailed answer here!
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.
// 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:
Upvotes: 0