2016-09-19 88 views
0

我嘗試在Typo3擴展中創建多個Viewhelpers。Typo3 8.2查看幫助命名空間

<?php 
namespace PdvPolymer\ViewHelpers; 
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper; 

class ButtonUpViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper 
{... 

視圖助手坐落在目錄擴展\類\ ViewHelpers

這個偉大的工程,當我把它與

<div xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers" xmlns:p="http://typo3.org/ns/Extension/ViewHelpers"> 
<p:buttonUp></p:buttonUp> 
</div> 

但現在我試圖把視圖助手在Sub -Directory like extension \ Classes \ ViewHelpers \ Custom

ViewHelper的新命名空間現在是

namespace Extension\ViewHelpers\Custom; 

現在我所說的視圖助手與

<p:custom.buttonUp></p:custom.buttonUp> 

但現在我得到這樣一個錯誤:

Oops, an error occurred! Code: 2016091908135339232bbd 

我的問題是,我是怎麼了? Typo3中的內部流體延伸與我一樣完全一樣。 我已經查過了!

有人想法嗎?

回答

3

有2個不同的問題。

首先,我建議避免命名空間聲明中的子目錄,並使用xmlns:p="http://typo3.org/ns/Extension/ViewHelpers"。在模板中調用ViewHelper時,總是添加子目錄路徑,例如

<p:custom.buttonUp></p:custom.buttonUp> 

您不需要申報兩次。

二)關於錯誤處理

使用的TypoScript config.contentObjectExceptionHandler = 0把它關掉你的開發系統,你會看到一個更有用的信息。您可以在docs中找到更多信息。

+0

第一部分不是真的答案,因爲我這樣做了。第二部分非常好,謝謝。我的錯誤是:我有兩個擴展與Viewhelper和第二個與使用Viewhelper的模板。只有當viewhelper的擴展被卸載並重新安裝時,typo3纔會清除viewhelper緩存。 –