[TYPO3-english] Fluid StandaloneView and AJAX

Alexander Dorn debao84 at googlemail.com
Fri Nov 22 19:03:13 CET 2013


Hi Wido,

the objectManager is loaded. My description was crap. :)

The function listApartmentAction is called via an eID-Script. This works fine and the function is executed correctly. 

The debugger shows me that all variables and the instance of the StandaloneView ($ajaxView) are initialized correctly.

The last line however produces an error.
>> $ajaxView->renderSection('ajax', array('viewMode', 'listView'));

This first block from this function looks like this:
public function renderSection(...) {
	$renderingContext = $this->getCurrentRenderingContext();
	if ($this->getCurrentRenderingType() === self::RENDERING_LAYOUT) {
		// in case we render a layout right now, we will render a section inside a TEMPLATE.
		$renderingTypeOnNextLevel = self::RENDERING_TEMPLATE;
	} else {
		$variableContainer = $this->objectManager->get('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TemplateVariableContainer', $variables);
		$renderingContext = clone $renderingContext;
		$renderingContext->injectTemplateVariableContainer($variableContainer);
		$renderingTypeOnNextLevel = $this->getCurrentRenderingType();
	}
	...
}
The error occurs when cloning the NULL-Object (underlined line)

In line 1 the following function is called and always returns NULL:
protected function getCurrentRenderingContext() {
	$currentRendering = end($this->renderingStack);
	return $currentRendering['renderingContext'];
}

The renderingStack is NULL so I have to fill this somehow. I got no clue what to do here.

If anyone knows what to to, please help me. :)

Thank You

Alexander


Am 21.11.2013 um 15:40 schrieb Wido Widlewski <typo3 at websimplex.de>:

> Hi Alexander,
> 
> maybe the objectManager is not loaded?
> 
> I used something like that:
> 
> if (!isset($this->objectManager)) {
> 	$this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('\TYPO3\CMS\Extbase\Object\ObjectManager');
> }
> 
> // create Fluid Standalone View
> $view = $this->objectManager->create('\TYPO3\CMS\Fluid\View\StandaloneView');
> 
> 
> Good Luck,
> 
> Wido
> 
> 
>> Hello,
>> 
>> I got a problem using the Fluid StandaloneView with TYPO3 6.1. I want to render a certain template section or partial for an AJAX-call.
>> 
>> I modified the code found here.
>> 
>> It would be awesome if someone could help.
>> Thank You
>> 
>> Regards
>> Alexander
>> 
>> Description of problem:
>> 
>> Inheritance of StandaloneView:
>> StandaloneView extends \TYPO3\CMS\Fluid\View\AbstractTemplateView which implements \TYPO3\CMS\Extbase\Mvc\View\ViewInterface.
>> 
>> When debugging the code below I get the following error:
>> __clone method called on non-object in /Volumes/www/b2bhomer/typo3/sysext/fluid/Classes/View/AbstractTemplateView.php on line 227
>> 
>> The error appears when calling $ajaxView->renderSection().
>> 
>> This line here always returns NULL which leads to the error above.
>> $renderingContext = $this->getCurrentRenderingContext();
>> 
>> public function apartmentListAction() {
>> 
>> 		/* @var $ajaxView \TYPO3\CMS\Fluid\View\StandaloneView */
>> 		$ajaxView = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
>> 
>> 		$extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
>> 		$templateRootPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($extbaseFrameworkConfiguration['view']['templateRootPath']);
>> 		$partialRootPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($extbaseFrameworkConfiguration['view']['partialRootPath']);
>> 
>> 		$templatePathAndFilename = $templateRootPath . '/Apartment/List.html';
>> 		$ajaxView->setTemplatePathAndFilename($templatePathAndFilename);
>> 		$ajaxView->setPartialRootPath($partialRootPath);
>> 
>> 		$ajaxView->assign($templatePathAndFilename, $templateRootPath);
>> 		$ajaxView->assign('apartments', $this->apartmentRepository->findAll());
>> 
>> 		return $ajaxView->renderSection('ajax', array('viewMode', 'listView'));
>> }
>> _______________________________________________
>> TYPO3-english mailing list
>> TYPO3-english at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>> 
>> 
> 
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english



More information about the TYPO3-english mailing list