[TYPO3-mvc] multiple instances of the same plugin on the same page

Pankaj Lele pankaj at lelesys.com
Tue Jul 26 15:22:11 CEST 2011


Hello Mario,

> Do I miss something, or I need to avoid multiple instances of the same
> plugin into the same page?

Yes, generally avoid multiple instances of same plugin on same page. You
can have a page for list view and another page for the show view.

But if you are really stuck with your project and deadline and you
really really want to have those plugins on same page then put your
actions in 3 different plugin namespaces by adding plugins in the
ext_tables.php and configure controller->actions for each in
ext_localconf.php. e.g.

ext_tables.php:

Tx_Extbase_Utility_Extension::registerPlugin(
	$_EXTKEY,
	'MyPluginInstanceOne',
	'My Plugin Instance one'
);
Tx_Extbase_Utility_Extension::registerPlugin(
	$_EXTKEY,
	'MyPluginInstanceTwo',
	'My Plugin Instance Two'
);
Tx_Extbase_Utility_Extension::registerPlugin(
	$_EXTKEY,
	'MyPluginInstanceThree',
	'My Plugin Instance three'
);

ext_localconf.php:

Tx_Extbase_Utility_Extension::configurePlugin(
	$_EXTKEY,
	'MyPluginInstanceOne',
	array(
		'YourController' => 'list,show',
	),
	array(
	)
);

Tx_Extbase_Utility_Extension::configurePlugin(
	$_EXTKEY,
	'MyPluginInstanceTwo',
	array(
		'YourController' => 'list,show',
	),
	array(
	)
);

Tx_Extbase_Utility_Extension::configurePlugin(
	$_EXTKEY,
	'MyPluginInstanceThree',
	array(
		'YourController' => 'list,show',
	),
	array(
	)
);

Then with <f:link.action> specify additional argument to target the link
to particular pluginName only.

<f:link.action action="show" arguments="{mydomain : mydomain}"
pluginName="MyPluginInstanceOne">
{mydomain.property}</f:link.action>

This way the URL parameters won't affect other plugins.

Hope this helps you :)

-Pankaj

-- 

With best regards,
Pankaj Lele
---------------------------

CTO & Executive Director
Lelesys Infotech Pvt. Ltd.
Pune/Goa, India

Web: http://www.lelesys.com

[Certified TYPO3 Integrator]


More information about the TYPO3-project-typo3v4mvc mailing list