[TYPO3-mvc] Custom view helpers in a partial called multiple times

François Suter fsu-lists at cobweb.ch
Thu Feb 21 09:07:02 CET 2013


Hi Christian,

> depending on your ViewHelper render method implementation it could be a
> problem of template "compilation". The templates and including
> viewhelpers are worked into raw php code to be executed faster. Maybe
> something went wrong with your custom VH. So have a look at the cached
> template parts with your VH. A good indicator is if a simple hardcoded
> return value produces the same issue or not. If not it is probably that
> problem (I think you can somehow disable compilation for your VH) if
> hardcoded return value produces the problem too then you might have
> found a bug...

Thanks for the hint, but the cached template is rather hard to read :-( 
I have copied the problematic part to the Gist 
(https://gist.github.com/fsuter/4997023). Looking at it I can't really 
understand what's wrong.

As expected the same kind of code repeats itself twice and looks really 
similar, except for increasing numbers in the variables names. The weird 
thing is that the arguments passed to the partial the second time (the 
ones listed in $array32) are available in the partial, i.e. I can print 
them with a simple

<p>{formation}</p>

for example, and they get used correctly in my conditions, but they are 
rendered as empty inside my custom viewhelper:

<vd:wiki parseText="true">{formation}</vd:wiki>

I'm ready to believe that my view helper contains errors, but I don't 
understand why it works the first time and not the second time. BTW I 
have added the view helper's code to the Gist too.

Cheers

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch


More information about the TYPO3-project-typo3v4mvc mailing list