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

Michael Knoll mimi at kaktusteam.de
Tue Oct 9 13:28:44 CEST 2007


Michael Knoll wrote:
> Hallo list,
> 
> I have the following problem: I have one controller for a search form 
> and another one for a result list. If the result list is displayed, I 
> want the search form to be displayed above it. So what I did was the 
> following:
> 
> In the result-list controller:
> 
> public function showSearchListAction() {
>     ...
>     $userSearchController =
>     $this->makeInstance('tx_mklvcommunity_controllers_userSearch');
>     $userSearchController->setSearchWord($searchWord);
>     $result .= $userSearchController->showUserSearchAction();
>     ...
> }
> 
> So this function (all in the search List controller) should instantiate 
> a search form controller and put it's result above the 
> search-list-controller result.
> 
> My search form controller action looks like this:
> 
> public function showUserSearchAction() {
>         $actionPipe =
>     $this->makeInstance('tx_mklvcommunity_models_user');
>         $actionPipe =
>     $this->makeInstance('tx_mklvcommunity_views_userSearch',        
>         $actionPipe);
>         if ($this->searchWord != '') {
>             $actionPipe->setSearchWord($this->searchWord);
>         }
>         $actionPipe->render('userSearchTemplate');
>         $actionPipe = $this->makeInstance('tx_lib_translatorProcessor',
>         $actionPipe);
>         $actionPipe->translate();
>         return $actionPipe->get('result');
> }
> 
> I get an error in the line with
> $actionPipe->render('userSearchTemplate');
> 
> Seems like some contexts are not set correctly, if I instantiate the 
> controller like that.
> 
> What am I doing wrong? I'd be glad, if you could help me out!
> 
> Greez
> 
> Mimi


The error message I get is the following:

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


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