[TYPO3-mvc] view renderer ignores action argument

g4-lisz at tonarchiv.ch g4-lisz at tonarchiv.ch
Wed Oct 12 00:03:32 CEST 2011


On 10/11/2011 10:56 PM, g4-lisz at tonarchiv.ch wrote:
> Hi there,
>
> in my action controller method i want to decide which template is 
> going to be displayed.
>
> This is because the layout looks a little bit different dependent of 
> the search demand:
>
> public function resultsAction(Tx_Myext_Domain_Model_SearchDemand 
> $demand) {
> [...]
>     if ($demand->getSpecialDemands() !== NULL) {
>         $action = 'resultsExtended';
>         echo "Extended";
>     }
>     else
>         $action = NULL;
> [...]
>     $this->view->attach(...);
>     $this->view->render($action);
> }
>
> If the template "ResultsExtended.html" does not exists, the rendere 
> complains about this.
> If it does exist, the template "Results.html" is displayed in place of 
> "ResultsExtended.html".
>
> I.e. in the end it's always the default layout which is rendered.
> Is there a solution to my problem?
>
> Thank you,
> Till
>
Got it!

     if ($demand->getSpecialDemands() !== NULL) {
         $this->request->setControllerActionName('resultsExtended');

Cheers,
Till


More information about the TYPO3-project-typo3v4mvc mailing list