[TYPO3-dev] Re: Communication between Plugins

Elmar Hinz t3elmar at googlemail.com
Thu Apr 18 09:02:16 CEST 2013


Hello Phillip,

> In my extension i have features like "dont display allready displayed" or "display closest".

"dont display already displayed" 

Do you speak of multiple plugins in one page not to display something or in succeeding calls? 

It you speek of succeeding calls, than you have to keep the state somehow between the calls.

The clean way for REST protocols is to use different nonambiguous URL.
That means to append appropriate parameters. Then the pages can even be cached
for the same combination of parametes. 

The unclean way is to keep the state on the server, in cookies or by a combination of both.

> List plugins with those settings use a static class. This dependency is not working if one plugin is cached, cause it wont fill the static class properties.

Now for multiple plugins within the same call to the page.

Plugins are evaluated in the order they appear in the TypoScript template. It makes sense to do communitation between them, 
in example not to repeat the same query on the database. Within the same call to the page. You use a static class for this communication.
Another option would by a global variable with a unique key: $GLOBALS[''tx_myextension].

1.) The order
==========

If the query to the database is done in only one of the plugins, it has to be the first one. 
Sometimes you want to use a plugin, that does only the query without output at all. 
You put that in the first place. Then you are free in the order of the other plugins.

2.) The caching
============

A plugin that is cached is only evaluated in the first caching run. 
In the next call to the page it can't set data to the static class. 

Now you are missing the result in other non-cached plugins.
Are you sure you need a combination of cached and un-cached plugins?

If you really need it, you can work with an uncached plugin without output
like in 1.)
 
> 
> So, i think i got to save those settings in something persistent for that page. My current thought is Typoscript.
> Should i simply create a new transient typoscript setting GLOBALS[TSFEE]->tmpl->setup or is there a better way to handle this?

I don't anderstand this part.

Regards

Elmar




More information about the TYPO3-dev mailing list