DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Instanciated Class

The Refresh provides methods, which you can use within an instanciated class only, like all methods, which handle with subparts.

Sample with getSubpart()

This is a sample with getSubpart(). It is exemplary for all methods with an instanciated class.

The TYPO3-API-method $cObj->getSubpart() will replaced by the same method of the TYPO3-API-class MarkerBasedTemplateService.

Extensions aren’t compatible with TYPO3 9.x, which are using the method $cObj->getSubpart().

Extensions are compatible with TYPO3 from 6.2 to 9.x, which are using the method getSubpart() of Refresh.

Code snippet of Refresh class MarkerBasedTemplateService

class MarkerBasedTemplateService
{
        public function getSubpart( $content, $marker )
        {
                ...

Use case in your extension

$MarkerBasedTemplateService = GeneralUtility::makeInstance( \Netzmacher\Refresh\Compatibility\Core\Service\MarkerBasedTemplateService::class );
$ajaxSubpartOfTheTemplate = $MarkerBasedTemplateService->getSubpart( $template, '###AJAX###' );

Best Practise with getSubpart()

This is a sample with getSubpart(). It is exemplary for all methods with an instanciated class.

Usually you are using the method getSubpart() multiple times in your extension. But you need an instance of the class MarkerBasedTemplateService once only.

For example the extension Browser [1] - TYPO3 without PHP - is using the method getSubpart() like in the snippets below.

Classes/AbstractPlugin.php

namespace Netzmacher\Browser;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
{
        public $MarkerBasedTemplateService;
        public function __construct()
        {
                parent::__construct();
                $this->MarkerBasedTemplateService = GeneralUtility::makeInstance( \Netzmacher\Refresh\Compatibility\Core\Service\MarkerBasedTemplateService::class );
        }
}

pi1/class.tx_browser_pi1.php

class tx_browser_pi1 extends \Netzmacher\Browser\AbstractPlugin
{
        ...
        public function main( $content, $conf )
        {
                ...
                // TYPO3 from 6.2 to 8.7
                //$ajaxSubpartOfTheTemplate = $this->cObj->getSubpart( $template, '###AJAX###' );
                // TYPO3 from 6.2 to 9.x
                $ajaxSubpartOfTheTemplate = $this->MarkerBasedTemplateService->getSubpart( $template, '###AJAX###' );
                ...
                // TYPO3 from 6.2 to 8.7
                //$searchformSubpartOfTheTemplate = $this->cObj->getSubpart( $template, '###SEARCHFORM###' );
                // TYPO3 from 6.2 to 9.x
                $searchformSubpartOfTheTemplate = $this->MarkerBasedTemplateService->getSubpart( $template, '###SEARCHFORM###' );
                ...
[1]Browser: from Browser version 8.7.2