[TYPO3-mvc] How to use my own ViewHelpers in Extbase 6.x using namespaces?

Tobias Liegl tliegl at gmail.com
Fri Jun 7 12:06:15 CEST 2013


Hi,

did you define a namespace in your BlablaViewHelper.php?

namespace MyVendor\MyExt\ViewHelpers;

And in your template file it has to look like this:

{namespace myext=\MyVendor\MyExt\ViewHelpers}

Tobi


Am 06.06.13 15:29, schrieb Felix Eggbert:
> Hey guys,
>
>
>
> I am in the process of updating an extension to namespaces in extbase
> introduced in v6 (?).
>
>
>
> I was wondering what's the right way to implement my own viewhelper now? My
> old viewhelpers still work like this
>
>
>
> BlablaViewHelper.php:
>
> ----------------------------
>
>> class Tx_MyExt_ViewHelpers_BlablaViewHelper extends
> Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper
>
>
>
> Template:
>
> -------------
>
> {namespace myext=Tx_MyExt_Viewhelpers}
>
> and
>
> <myext:blabla/>
>
>
>
> On the interwebs I read about the new way of using namespaces here, too but
> I don't seem to get it to work. This was my approach:
>
>
>
> BlablaViewHelper.php:
>
> ----------------------------
>
>
>
> class BlablaViewHelper extends
> \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractViewHelper
>
>
>
> Template:
>
> {namespace myext=\MyVendor\MyExt\Classes\ViewHelpers}
>
> and
>
> <myext:blabla/>
>
>
>
> But it doesn't get rendered in fluid, instead the naked tag is rendered
> ("<myext:blabla/>" right in the output). As if the namespace declared in the
> Fluid template is not recognized.
>
>
>
> Can anybody explain to me how this is done correctly or what I am doing
> wrong?
>
>
>
> Thanks a lot and best regards,
>
>
>
> Felix
>
>
>



More information about the TYPO3-project-typo3v4mvc mailing list