2017-06-05 93 views
1

在ExtensionBuilder的帮助下,我为TYPO3(7.6.15)创建了一个简单的后端模块。 UserControllerMediaController具有createAction,showActionlistAction。该PanelController只是有showAction这是模块的主视图,应该是这样的:TYPO3:后端模块渲染另一个控制器的动作

Display of the PanelController.showAction

现在,我想渲染来自其他控制器的listActionsPanelController.showAction和我会的模板如果可能,请在视图的模板(MyExt/Resources/Private/Templates/Panel/Show.html)中执行此操作。

我非常感谢所有帮助,并祝大家度过愉快的一天!

回答

0
/** 
* Redirects the request to another action and/or controller. 
* 
* @param string $actionName Name of the action to forward to 
* @param string $controllerName Unqualified object name of the controller to forward to. If not specified, the current controller is used. 
* @param string $extensionName Name of the extension containing the controller to forward to. If not specified, the current extension is assumed. 
* @param array $arguments Arguments to pass to the target action 
* @param integer $pageUid Target page uid. If NULL, the current page uid is used 
* @param integer $delay (optional) The delay in seconds. Default is no delay. 
* @param integer $statusCode (optional) The HTTP status code for the redirect. Default is "303 See Other" 
*/  
protected function redirect(
     $actionName, 
     $controllerName = NULL, 
     $extensionName = NULL, 
     array $arguments = NULL, 
     $pageUid = NULL, 
     $delay = 0, 
     $statusCode = 303 
    ) 

您必须在重定向方法中传递控制器名称和操作名称才能调用另一个控制器的操作。

请查阅以上帮助您的方法。

或者如果你在模板本身做的事情比可能你必须调用viewhelper。

+0

此代码去哪里,它从哪里调用? – nHaskins

+1

这不是我想要的,但是对于@nHaskins,它可以在任何控制器内部调用,该控制器通过$ this-> redirect('action','')继承'\ TYPO3 \ CMS \ Extbase \ Mvc \ Controller \ ActionController'。 Controller');'但请参阅_redirect_和_forward_ [此处]的文档(https://api.typo3.org/typo3cms/current/html/class_t_y_p_o3_1_1_c_m_s_1_1_extbase_1_1_mvc_1_1_controller_1_1_abstract_controller.html#ac9e12bf23f76776a8b233713773d9de2) – Xervia

相关问题