I'm rendering in an standalone view a TypoScript Object with the cObject ViewHelper. That TS Object gets tt_content from other pages currently. But the result has the INT_SCRIPT markers and not the real content.
here's my code on how to make the standalone view, the template and the TypoScript:
Inside controller:
public function renderStandaloneView($template = 'View/Show', $variables = array(), $fileExt = 'html', $noCache = TRUE) {
if ( $noCache === TRUE ) $GLOBALS['TSFE']->set_no_cache();
// Get standalone view
$configuration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$view = $this->objectManager->get(StandaloneView::class);
$view->getRequest()->setControllerExtensionName($this->extensionName);
$view->setFormat($fileExt);
$view->setLayoutRootPaths($configuration['view']['layoutRootPaths']);
$view->setPartialRootPaths($configuration['view']['partialRootPaths']);
$view->setTemplateRootPaths($configuration['view']['templateRootPaths']);
$view->setTemplate($template);
// Render view
$view->assignMultiple($variables);
return $view->render();
}
TypoScript:
lib.myContent = COA
lib.myContent {
10 = CONTENT
10 {
table = tt_content
select {
orderBy = sorting
where = 0
where.wrap = colPos=|
pidInList.field = uid
}
}
}
Fluid:
<f:for each="{myvars}" as="myvar" iteration="it">
<f:cObject typoscriptObjectPath="lib.myContent" data="{uid:'{myvar.uid}'}" />
</f:for>
I cannot change all the uncached elements (like content elements / plugins) on that pages to be cached.
So how can i parse the standalone view including the non cached content and not insert the INT_SCRIPT markers?
Thanks for anything!
Found a solution. Maybe it isn't the best way to resolve that problem. But at the moment it works fine.
public function renderStandaloneView($template = 'View/Show', $variables = array(), $fileExt = 'html') {
// Get standalone view
$configuration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$view = $this->objectManager->get(StandaloneView::class);
$view->getRequest()->setControllerExtensionName($this->extensionName);
$view->setFormat($fileExt);
$view->setLayoutRootPaths($configuration['view']['layoutRootPaths']);
$view->setPartialRootPaths($configuration['view']['partialRootPaths']);
$view->setTemplateRootPaths($configuration['view']['templateRootPaths']);
$view->setTemplate($template);
// Render view
$view->assignMultiple($variables);
// Handle the INT_SCRIPT markers
$content = $view->render();
$contentBak = $GLOBALS['TSFE']->content;
$GLOBALS['TSFE']->content = $content;
$GLOBALS['TSFE']->INTincScript();
$content = $GLOBALS['TSFE']->content;
$GLOBALS['TSFE']->content = $contentBak;
unset($contentBak);
return $content;
}
For your information. I need this to handle content from pages and send them by mail or render a pdf with an external tool. But some content or pages are only available for the current user (not a group or another user). And i didn't want to login that user inside the controller or else. i think that's the best case to handle that.
Other solutions are still welcome :-)