/** * Render the given template as ICS file * * @param string $actionName * * @return void */ public function render($actionName = NULL) { $content = parent::render($actionName); header('Content-type: text/calendar; charset=utf-8'); header('Content-Disposition: inline; filename=event.ics'); echo $content; die; }
/** * @param string $viewHelperTemplate * @param string $expectedOutput * * @test * @dataProvider viewHelperTemplateSourcesDataProvider */ public function renderingTest($viewHelperTemplate, $expectedOutput) { $view = new TemplateView(); $view->assign('settings', ['test' => '<strong>Bla</strong>']); $templateString = '{namespace ft=TYPO3Fluid\\FluidTest\\ViewHelpers}'; $templateString .= $viewHelperTemplate; $view->getRenderingContext()->getViewHelperResolver()->addNamespace('ft', 'TYPO3Fluid\\FluidTest\\ViewHelpers'); $view->getRenderingContext()->getTemplatePaths()->setTemplateSource($viewHelperTemplate); $this->assertSame($expectedOutput, $view->render()); }
/** * Render the given data by the defined Fluid Template * * @param array $data data values * @param string $templatePath * @return string */ public static function renderValueByTemplate(array $data, $templatePath) { if (!file_exists($templatePath)) { $templatePath = GeneralUtility::getFileAbsFileName($templatePath); } self::getFluidRenderer()->setTemplatePathAndFilename($templatePath); self::$fluidRenderer->assign('data', $data); $rendered = self::$fluidRenderer->render(); return $rendered; }
/** * Gets the message for a notification mail as fluid template * * @param Comment $comment comment which triggers the mail send method * @return string The rendered fluid template (HTML or plain text) * * @throws \Exception */ protected function getMailMessage(Comment $comment) { $mailTemplate = GeneralUtility::getFileAbsFileName($this->getTemplatePath()); if (!file_exists($mailTemplate)) { throw new \Exception('Mail template (' . $mailTemplate . ') not found. '); } $this->fluidTemplate->setTemplatePathAndFilename($mailTemplate); // Assign variables $this->fluidTemplate->assign('comment', $comment); $this->fluidTemplate->assign('settings', $this->settings); $uriBuilder = $this->controllerContext->getUriBuilder(); $subFolder = $this->settings['subFolder'] ? $this->settings['subFolder'] : ''; $articleLink = 'http://' . GeneralUtility::getHostname() . $subFolder . '/' . $uriBuilder->setTargetPageUid($comment->getPid())->setAddQueryString($this->getAddQueryStringToLinks())->setArgumentsToBeExcludedFromQueryString(array('id', 'cHash', 'tx_pwcomments_pi1[action]', 'tx_pwcomments_pi1[controller]'))->setUseCacheHash(FALSE)->buildFrontendUri(); $this->fluidTemplate->assign('articleLink', $articleLink); $backendDomain = $this->settings['overwriteBackendDomain'] ? $this->settings['overwriteBackendDomain'] : GeneralUtility::getHostname(); $backendLink = 'http://' . $backendDomain . $subFolder . '/typo3/alt_doc.php?M=web_list&id=' . $comment->getPid() . '&edit[tx_pwcomments_domain_model_comment][' . $comment->getUid() . ']=edit'; $this->fluidTemplate->assign('backendLink', $backendLink); return $this->fluidTemplate->render(); }
/** * Loads the template source and render the template. * If "layoutName" is set in a PostParseFacet callback, it will render the file with the given layout. * * Additionally amends the rendered template with a module template "frame" * * @param string $actionName If set, the view of the specified action will be rendered instead. Default is the action specified in the Request object * @return string Rendered Template * @api */ public function render($actionName = null) { $actionViewContent = $this->templateView->render($actionName); $this->moduleTemplate->setContent($actionViewContent); return $this->moduleTemplate->renderContent(); }
/** * assign content * * @return MailView */ protected function assignContent() { $html = parent::render(); $request = $this->controllerContext->getRequest(); $resetFormat = $request->getFormat(); $request->setFormat('txt'); if ($this->canRender($this->controllerContext)) { $txt = parent::render(); } $request->setFormat($resetFormat); $this->mail->setBody($html, 'text/html'); if (isset($txt) && strlen($txt)) { $this->mail->addPart($txt, 'text/plain'); } return $this; }
/** * Render XML Content as single Output */ public function render() { $c = parent::render(); header("Content-Type:text/xml"); die($c); }