[TYPO3-mvc] Action runs several times according to the amount of same plugins

Jonas Götze jonnsn at gmail.com
Fri Mar 11 10:35:04 CET 2011


Hi Markus,
Am 11.03.2011 10:05, schrieb Oberndörfer, Markus:
> To whom it may concern ...
>
> At my actual project I am trying to create a banner extension with extbase and fluid. On the website are several different banners that can be presented by several plugins of the same kind.
>
> In my controller I have two actions, one for showing the banners in the plugins - that is working very fine - and one action for the counting of clicks and the redirect after someone has made a click on a banner. The counting action is called by a<f:link.action>  link in the fluid template.
>
> Unfortunately the counting action is running several times, according to the number of banner plugins on the website. This means every run leads to an increment of the banner click counter. So I have tried to work dirty with an "exit;" statement to limit the runs of the action to a single time, but this doesn't work properly because the
> update of the banner object at the according repository seems to be made at the last of the several runs of the action.
>
> In a test I have reduced the code of the plugins (fluid-template) and the action to the absolute minimum, but the amount of runs remains dependend on the amount of identical plugins on the website. Is this behavior of the action intended as it is? Can someone give me a hint for a clean solution?
>
> Best regards and wishes for a sunny weekend
>
> Markus

If you have multiple instances of one plugin on one page and create a 
link using f:link.action I assume the parameters are used for all 
instances of the plugin, what leads to the behaviour you described.
(But I wonder why exit() should not work then...)
One possbible solution might be to insert the plugin one more time on a 
hidden page and set the parameter pageUid of the f:link.action to this 
page (configurable via flexform or Typoscript, like the singleView Page 
in tt_news for example). As you redirect from there anyway this won't 
affect the users. Also you could create a second plugin on the origin 
page which does the redirect and use the pluginName-Parameter of 
f:link.action.

Hth.

Regards
Jonas


More information about the TYPO3-project-typo3v4mvc mailing list