我尝试在Typo3扩展程序中创建多个Viewhelper。
<?php
namespace PdvPolymer\ViewHelpers;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
class ButtonUpViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper
{...
ViewHelper位于目录扩展名\ Classes \ ViewHelpers
中当我用
调用它时,这很有用<div xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers" xmlns:p="http://typo3.org/ns/Extension/ViewHelpers">
<p:buttonUp></p:buttonUp>
</div>
但是现在我已经尝试将ViewHelper放在子目录中了 扩展\类\ ViewHelpers \自定义
ViewHelper的新命名空间现在是
namespace Extension\ViewHelpers\Custom;
现在我用
调用ViewHelper<p:custom.buttonUp></p:custom.buttonUp>
但现在我得到一个错误:
Oops, an error occurred! Code: 2016091908135339232bbd
我的问题是,我错了什么? Typo3中的内部Fluid-Extension就像我一样。 我检查了一下!
有人有想法吗?
答案 0 :(得分:4)
有两个不同的问题。
首先,我建议避免命名空间声明中的子目录,只使用xmlns:p="http://typo3.org/ns/Extension/ViewHelpers"
。始终在调用ViewHelper时添加子目录路径,然后在模板中添加,例如
<p:custom.buttonUp></p:custom.buttonUp>
你不需要两次宣言。
2nd)关于错误处理
使用TypoScript config.contentObjectExceptionHandler = 0
为您的开发系统关闭它,您将看到更有用的消息。您可以在docs中找到更多信息。