[TYPO3-dev] Calling $this->cObj->CONTENT from inside a plugin denied
    Sebastian Gebhard 
    sebastiangebhard at hoch2.de
       
    Mon Mar  1 13:57:44 CET 2010
    
    
  
Hi,
I found this in tslib_cObj::CONTENT:
$originalRec = $GLOBALS['TSFE']->currentRecord;
if ($originalRec)	{
	$GLOBALS['TSFE']->recordRegister[$originalRec]++;
}
Commented with: "If the currentRecord is set, we register, that this 
record has invoked this function. It's should not be allowed to do this 
again then!!"
Why is there this restriction? Why am I not allowed to render a CONTENT 
element inside a plugin?
For my needs I wrote a workaround:
function getColoumn($col) {
	
		// Workaround
	$currentRecord = $GLOBALS['TSFE']->currentRecord;
	unset($GLOBALS['TSFE']->currentRecord);
	
	$contentConf = array(
		'table' => 'tt_content',
		'select.' => array(
			'where' => 'colPos = ' . $col,
			'orderBy' => 'sorting',
		),
		'wrap' => '<div class="col' . $col . '">|</div>'
	);
	$content = $this->cObj->CONTENT($contentConf);
	$GLOBALS['TSFE']->currentRecord = $currentRecord;
	
	return $content;
	
}
Kind regards,
Sebastian
    
    
More information about the TYPO3-dev
mailing list