[TYPO3-mvc] Sharing template among actions OR switching one action from USER to USER_INT

Franz Koch typo3.RemoveForMessage at elements-net.de
Mon Feb 8 16:04:13 CET 2010


Hi,

short question, is there a way to share the same template among 
controller actions? I know I could use partials, but having to assing 
several template variables again and again for partials is a pain in the 
a... - also dealing with layouts in this case.

Another solution would be to switch one action dynamically to USER_INT 
if a certain parameter is given in the url. But I haven't found a 
function in extbase's MVC architecture that would allow me to do so. I 
even wonder if this is wise in terms of performance, as extbase would 
have to be initialized twice for the same action. The implementation 
itself would be quite easy though. The actionController would have to 
call the dispatcher that itself is destructing extbase and calling 
'$this->cObj->convertToUserIntObject()';

Unfortunately I also can't use a simple TS condition to switch my plugin 
to USER_INT as I have several instances of the plugin on my page and I 
only need to switch one of them :/


Scenario:
I've got one page with a common product list that should be cacheable. 
The same list can be filtered by a search field, so as soon as there is 
a search parameter in the URI I don't want the output to be cached. So I 
either have to use two different actions (sharing the same template) or 
I have to switch one action dynamically to USER_INT.

Thanks for your ideas on how to solve this. For now I copied the 
templates, which is not that nice having duplicate templates :(
-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list