[TYPO3-mvc] How can I give content to a ViewHelper when using alternative syntax?

Claus Due claus at wildside.dk
Fri Aug 3 16:52:02 CEST 2012


Hi Oliver,

On Aug 3, 2012, at 4:39 PM, Oliver Salzburg <oliver.salzburg at googlemail.com> wrote:

> I had the idea of simply writing my own ViewHelper that only renders a
> link, but takes the content, not from its children, but from a
> parameter passed to it. Then I could use *that* ViewHelper to render my
> link.

That is probably the better option for you - but you may still have issues
with HTML entity encoded RTE text. Decoding those cound be unreliable.
I don't know but can imagine issues.

That would also solve your question about fetching the page ID to link to.
You could just set that from the ViewHelper.

> But I also don't understand how to even approach that. Where would I
> put said ViewHelper so that it is even found by "the system"?
> Or better yet, how can I tell the "the system" about the existence of
> my ViewHelper?

That ViewHelper should be placed in your own extension. If you build an
empty extension using extension_builder and create Classes/ViewHelpers
and then check any ViewHelper in existence for how the class should look.

Or use the skeleton ViewHelper I linked to - just wipe the body of the render
method.

> Understanding that might already bring me a tiny step closer to putting
> this issue to rest.

In that case I hope the above works for you :)

Cheers,
Claus


More information about the TYPO3-project-typo3v4mvc mailing list