[TYPO3-mvc] Displaying and modifying session data on same page

bernd wilke t3ng at bernd-wilke.net
Tue Jun 2 08:17:14 CEST 2015


Am 01.06.15 um 11:51 schrieb Jan Kornblum:
> Dear newsgroup,
>
> a plugin is placed twice on the same page: Plugin (A) is located in the
> page header and *shows* any session data ("5 items in basket"). Plugin
> (B) is located in the content area below and *modifies* the session data
> ("add to basket, remove from basket", "list items"). Both plugin are
> uncached.
>
> When the page is submitted ("add to basket"), the requested page still
> shows the "old" basket amount. The reason seems to be that the modifying
> plugin (B) is called *after* the displaying plugin (A) has already been
> called.
>
> Is there a possibility to tell TYPO3 which plugin should be executed
> first (without changing the location the plugin is embedded in the FLUID
> template)?
>
> Or is there anything that is generally wrong with my approach?

you need to change the handling of action.
modifying session-data can not be done by a special plugin, which might 
be executed very late, but on any plugin of yours, or an 'invisible' 
plugin on every page.
that is just for actions to modify session data.

e.g. the TYPO3 (FE-)login/logout is handled before any rendering takes 
place. independent of any positioning of a login-plugin, so you can 
login to any page with just the right parameter in the page call. 
content in the page can be shown according the login state.

you might use a hook or include an invisible plugin in every page by 
typoscript or a real plugin without output in the page header-area.

be careful if you handle session-modifying action in every plugin: only 
the first plugin needs to handle the action and unset the request or set 
a flag for following plugins, so the action is not processed twice or more.

bernd
-- 
http://www.pi-phi.de/cheatsheet.html


More information about the TYPO3-project-typo3v4mvc mailing list