TYPO3:后端模块渲染另一个控制器的动作
TYPO3: Backend Module render action of another Controller
我在 ExtensionBuilder 的帮助下为 TYPO3 (7.6.15) 创建了一个简单的后端模块。 UserController
和 MediaController
有 createAction
、showAction
和 listAction
。 PanelController
只有 showAction
是模块的主视图,应该如下所示:
现在,我想在 PanelController.showAction
的模板中从其他控制器渲染 listActions
并且我想在视图的模板中进行渲染 (MyExt/Resources/Private/Templates/Panel/Show.html
), 如果可能的话。
在此先感谢大家的帮助,祝大家有个愉快的一天!
/**
* 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。
好吧,多年来我什至没有意识到这个问题仍然悬而未决。我只是加载了两个外部控制器来获取我需要的所有数据。然后我将数据传递给视图本身内的正确视图模板,这些模板是原始列表操作的视图。
我在 ExtensionBuilder 的帮助下为 TYPO3 (7.6.15) 创建了一个简单的后端模块。 UserController
和 MediaController
有 createAction
、showAction
和 listAction
。 PanelController
只有 showAction
是模块的主视图,应该如下所示:
现在,我想在 PanelController.showAction
的模板中从其他控制器渲染 listActions
并且我想在视图的模板中进行渲染 (MyExt/Resources/Private/Templates/Panel/Show.html
), 如果可能的话。
在此先感谢大家的帮助,祝大家有个愉快的一天!
/**
* 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。
好吧,多年来我什至没有意识到这个问题仍然悬而未决。我只是加载了两个外部控制器来获取我需要的所有数据。然后我将数据传递给视图本身内的正确视图模板,这些模板是原始列表操作的视图。