[TYPO3-mvc] Using ViewHelpers inside ViewHelpers?

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu Jan 21 11:45:10 CET 2010


Hi,

> But I would need the link to create piVars for both plugins, like
> this:
>
> index.php?id=home&tx_myext_menu[action]=render&tx_myext_menu[category]=4&tx_myext_products[action]=list&tx_myext_products[category]=4
>
> Is this possible with the link.action ViewHelper? Or would a different
> solution be better?

I'd say it would be better to use the same extension key for both - also 
when thinking of realUrl etc. And it's actually no big deal at all. So 
you have two possibilities now:

a) use the same extension/plugin having a flexform to configure which 
action and controller the plugin instance should execute (categoryMenu 
or products).

b) keep them separate and fetch the configuration of your products 
plugin inside your category plugin by hand ($parameters = 
t3lib_div::_GP('tx_myext_products')). Of course you need to validate the 
values by your own then (making sure the IDs are integer values etc.). 
In your templates you then can tell your f:link.action viewHelper to 
create the links for a different plugin (as I just found out), see this 
description of the viewHelper:

* @param string $extensionName Target Extension Name (without "tx_" 
prefix and no underscores). If NULL the current extension name is used
* @param string $pluginName Target plugin. If empty, the current plugin 
name is used

so in your case, it might be working with:
<f:link.action action="render" controller="products" 
arguments="{category:category}" 
extensionName="myextProducts">{category.title}</f:link.action>

Please note that I haven't tested this and that I'm not sure about the 
correct writing of the extensionName.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list