0
votes

I'm trying to use a custom view helper inside a fluid template. I followed the official docs.

I can't get it to work though. I always get the error

The ViewHelper "blog:gravatar>" could not be resolved. Based on your spelling, the system would load the class "MyVendor\ExtKey\ViewHelpers\GravatarViewHelper", however this class does not exist.

I set the namespace in the view helper like this: namespace MyVendor\ExtKey\ViewHelpers; and include it in the fluid template like this: {namespace blog=MyVendor\ExtKey\ViewHelpers} I already tried different paths for the namespace like:

ExtKey\Classes\ViewHelpers

thats were the view helper is located in the file structure. Or even the absolute path.

The file structure looks like this:

extkey--Classes--ViewHelpers--GravatarViewHelper.php

extkey--Resources--Private--Templates--Page--fluidtemplate.html

Is there anything i have to do beforehand, which is not written in the docs?

1

1 Answers

1
votes

The problem was the vendor name "MyVendor" this name can't be freely chosen like i read somewhere in the docs.

I created the extension with the sitepackagebuilder and the vendor name has to be whatever you entered for Company name.