[TYPO3-mvc] Howto render mail-templates?

Robert Böttner lists at boettner.it
Tue Aug 3 18:13:06 CEST 2010


Hi Sven,

or use this method:

/**
     * renders the given Template file via fluid rendering engine.
     * 
     * @param string	$templateFile	absolute path to the template File
     * @param array 	$vars 			an array of all variables you want to assgin to the view f.e: array('blog'=> $blog, 'posts' => $posts)
     *
     * @return string of the rendered View. 
     */
    protected function renderFileTemplate($templateFile, array $vars) {
        $templateParser = Tx_Fluid_Compatibility_TemplateParserBuilder::build();
        $objectManager = t3lib_div::makeInstance('Tx_Fluid_Compatibility_ObjectManager');

        $templateContent = file_get_contents($templateFile);
        if ($templateContent !== false) {
            $content = $templateParser->parse($templateContent);
            $variableContainer = $objectManager->create('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer', $vars);
            $renderingContext = $objectManager->create('Tx_Fluid_Core_Rendering_RenderingContext');
            $renderingContext->setTemplateVariableContainer($variableContainer);
            $viewHelperVariableContainer = $objectManager->create('Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer');
            $renderingContext->setViewHelperVariableContainer($viewHelperVariableContainer);

            $data = $content->render($renderingContext);
            return $data;
        }
    }

Cheers
Robert.

Am 03.08.2010 um 16:59 schrieb Sven Kalbhenn:

> Hi folks,
> 
> I'm writing a new extension with extbase and fluid - and it's a lot of fun so far! ;o)
> 
> But now I want to send a mail to the admin with some data from a form - but I don't know how to render a mail-template with fluid?
> Any ideas how to do this?
> 
> CU...Sven Kalbhenn
> 
> 
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list