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

Felix Eggbert eggbert at phez.com
Fri Jun 7 12:32:18 CEST 2013


Hi Tobi,

thanks for your reply...

Yes, I did define a namespace like that in my VH, still no success. 

After posting my first message I realized, that I must have made a mistake
here:

I guess instead of \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractViewHelper it
should rather be \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper. I did
change that, still no success. I mean, shouldn’t the first example throw an
exception anyway? But obviously it doesn't even get that far...

Hm...

Felix



-----Ursprüngliche Nachricht-----
Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org
[mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von
Tobias Liegl
Gesendet: Freitag, 7. Juni 2013 12:06
An: typo3-project-typo3v4mvc at lists.typo3.org
Betreff: Re: [TYPO3-mvc] How to use my own ViewHelpers in Extbase 6.x using
namespaces?

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
>
>
>

_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list