TYPO3 Fluid:自 TYPO3 4.6 起使用自己的流体渲染器失败
我在扩展中使用了自己的流体渲染器:
/**
* Makes and returns a fluid template object
*
* @return Tx_Fluid_View_TemplateView the fluid template object
*/
protected function makeFluidTemplateObject() {
/** @var Tx_Fluid_View_TemplateView $fluidTemplate */
$fluidTemplate = t3lib_div::makeInstance('Tx_Fluid_View_TemplateView');
// Set controller context
$controllerContext = $this->buildControllerContext();
$controllerContext->setRequest($this->request);
$fluidTemplate->setControllerContext($controllerContext);
return $fluidTemplate;
}
稍后我使用此 $fluidTemplate
来分配模板文件、变量并渲染它:
/**
* Gets the mail message
*
* @param mixed $registration model to give to template
* @param string $templatePath path of fluid template
*
* @return string The rendered fluid template (HTML or plain text)
*/
public function getMailMessage($registration, $templatePath) {
$mailTemplate = t3lib_div::getFileAbsFileName($templatePath);
if (!file_exists($mailTemplate)) {
throw new Exception('Mail template (' . $mailTemplate . ') not found. ');
}
$this->fluidTemplate->setTemplatePathAndFilename($mailTemplate);
// Assign variables
$this->fluidTemplate->assign('registration', $registration);
$this->fluidTemplate->assign('settings', $this->settings);
return $this->fluidTemplate->render();
}
一切正常,除了 ->render()调用。从 TYPO3 4.6 开始,我收到错误 500,没有任何指定的异常。使用 TYPO3 4.5 LTS,它可以正常工作!
我希望有人有想法。提前致谢!
I used in an extension an own fluid renderer:
/**
* Makes and returns a fluid template object
*
* @return Tx_Fluid_View_TemplateView the fluid template object
*/
protected function makeFluidTemplateObject() {
/** @var Tx_Fluid_View_TemplateView $fluidTemplate */
$fluidTemplate = t3lib_div::makeInstance('Tx_Fluid_View_TemplateView');
// Set controller context
$controllerContext = $this->buildControllerContext();
$controllerContext->setRequest($this->request);
$fluidTemplate->setControllerContext($controllerContext);
return $fluidTemplate;
}
I use this $fluidTemplate
later to assign template-file, variables and render it:
/**
* Gets the mail message
*
* @param mixed $registration model to give to template
* @param string $templatePath path of fluid template
*
* @return string The rendered fluid template (HTML or plain text)
*/
public function getMailMessage($registration, $templatePath) {
$mailTemplate = t3lib_div::getFileAbsFileName($templatePath);
if (!file_exists($mailTemplate)) {
throw new Exception('Mail template (' . $mailTemplate . ') not found. ');
}
$this->fluidTemplate->setTemplatePathAndFilename($mailTemplate);
// Assign variables
$this->fluidTemplate->assign('registration', $registration);
$this->fluidTemplate->assign('settings', $this->settings);
return $this->fluidTemplate->render();
}
Everything works, except the ->render()
call. I get an error 500 without any specified exception, since TYPO3 4.6. With TYPO3 4.5 LTS it is working!
I hope someone has an idea. Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 TYPO3 v4.6 开始,您不再需要构建整个控制器上下文。现在通过
Tx_Fluid_View_StandaloneView
处理 (Fluid 1.4.0)初始化视图:
函数
getMailMessage($registration, $templatePath)
保持不变。Since TYPO3 v4.6 you don't need to build the whole controller context anymore. It's now handled via
Tx_Fluid_View_StandaloneView
(Fluid 1.4.0)Initialize the view:
The function
getMailMessage($registration, $templatePath)
remains unchanged.