0

Some years ago I developed an extension as backend module. It can run on TYPO3 7 LTS. Recently I updated it and want to let it run on TYPO3 8 LTS.

It is not based on Extbase, the main class path is mod1/index.php.

In this index.php there is the main class tx_xxxxx_module1. In the class tx_xxxxxx_module1 there are multiple functions, which can generate wished contents. At the end of the index.php a function is called to print the content (into an iframe): $SOBE->printContent();

//index.php
<?php
global $MCONF;
require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('xxxxx').'mod1/conf.php';

class  tx_xxxxx_module1 extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
    ......

    function main()    {
        ......
    }

    ......

    function printContent()    {
        ......
    }
}

......

$SOBE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_xxxxx_module1');
$SOBE->main();
$SOBE->printContent();

?>

Here $SOBE is an instance (singleton) of the class tx_xxxxxx_module1; in the function printContent() there is nothing other than an echo command:

function printContent()    
{
    echo $this->content;
}

This works well for TYPO3 7. But in TYPO3 8, I saw nothing in the iframe. So I added an exit command in the function printContent(). Problem solved! The content appeared in the iframe!

function printContent()    
{
    echo $this->content;
    exit;
}

My question: is this workaround (using exit) good or not? Are there any other better or recommended approaches to doing it?

1 Answer 1

1

This sounds ok but I would think about refactoring the code in total if you need that, also switch to fluid for templating and so on. however there is no need to switch to extbase if you don't need it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.