[TYPO3-ect] lib/div: Problems with using controller as sub-controller

Michael Knoll mimi at kaktusteam.de
Tue Oct 9 20:44:34 CEST 2007


Elmar Hinz wrote:
> Hi,
> 
> 
>> $userSearchController =
>> $this->makeInstance('tx_mklvcommunity_controllers_userSearch');
> 
> Have a look at the source of makeInstance() here. It's not optimized to
> create subcontrollers. I suspect that the subcontroller doesn't get a
> configuration handed and can't build an own configurations object. I am not
> sure.
> 
> line 104:  elseif($this->controller->configurations->get($keyOrValue))
> 
> Fatal error: Call to a member function get() on a non-object in 
> /var/www/localhost/svn/subida/typo3conf/ext/lib/class.tx_lib_processorBase.php 
> on line 104
> 
> 
> I see two options as a solution:
> 
> a) Make list and form two different plugins
> 
> or 
> 
> b) Have a look at the resultbrowser inclusion as a processor and
> subcontroller, to find out how that can work.
> 
> Regards
> 
> Elmar
> 

Hi Elmar,

ok - it was the missing configurations attribute. I fixed it via

$userSearchController =
	$this->makeInstance('tx_mklvcommunity_controllers_userSearch');
$userSearchController->defaultAction = 'showUserSearch';
$userSearchController->setSearchWord($searchWord);
$userSearchController->configurations = $this->configurations;
$result .= $userSearchController->showUserSearchAction();

Now it works, but only because the two configurations are the same. If 
I'd called the controller from another controller in another plugin, it 
wouldn't work.

Is there a function so get the configuration for a certain plugin or is 
it given by the core, when the plugin is called as a page content?

I think for versatile usage it would be great to have such a 
subcontroller concept, perhaps, we could do something like a 
subcontroller factory, that sets the context for the controller if 
instantiated in the way I use it.

Or is there a completely different approach to solve this problem, which 
I'm not getting yet?

Greez

Mimi



More information about the TYPO3-team-extension-coordination mailing list