I need to render with my extension a specific content from tt_content.
How can I do this?
\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer ?
I need to render with my extension a specific content from tt_content.
How can I do this?
\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer ?
You can use the Typoscript CONTENT object and pass it to a fluid ViewHelper:
lib.myContent = CONTENT
lib.myContent {
table = tt_content
select {
pidInList = yourPid
where = uid=yourContentElementID
}
}
In your extension using Fluid:
<f:cObject typoscriptObjectPath="lib.myContent" />
You can also pass values through the viewHelper, see here
You can do it from the controller too. If I understood your question, you may want to try this
$cObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer');
Following script will be use PI base extension.
$uid = $this->cObj->data['uid'];
if ($this->cObj->data['_LOCALIZED_UID']) {
$uid = $this->cObj->data['_LOCALIZED_UID'];
}
Following script will be use in EXT BASE extension.
$this->contentObj = $this->configurationManager->getContentObject();
$uid = $this->contentObj->data['uid'];
For more information about TYPO3 stuff you may visit my blog
In Extbase extensions
$this->cObj
is no more available in the current scope, so you need to get it first before you can use: