[TYPO3-mvc] Re: If you want to render something with fluid directly

Nils Blattner nb at cabag.ch
Fri Feb 19 14:55:13 CET 2010


I had to generate creation mails and thought, why not make them with 
fluid templates.
It took me some time to find how to do it, but eventually I was able to 
track the bugger down and crop away the unneded stuff.

$this->registerMail holds the absolute path to the template.

	
	/**
	 * Returns a view which will be sent via mail.
	 *
	 * @return Tx_Fluid_View_TemplateView Template view.
	 */
	protected function getCreateMailView() {
	 	$view = $this->objectManager->getObject('Tx_Fluid_View_TemplateView');
		$controllerContext = $this->buildControllerContext();
		$view->setControllerContext($controllerContext);

		// Template Path Override
		$view->setTemplatePathAndFilename($this->registerMail);
		
		if (method_exists($view, 'injectSettings')) {
			$view->injectSettings($this->settings);
		}
		$view->initializeView(); // In FLOW3, solved through Object Lifecycle 
methods, we need to call it explicitely
		$view->assign('settings', $this->settings); // same with settings 
injection.
		return $view;
	}


More information about the TYPO3-project-typo3v4mvc mailing list