我有两个扩展程序,我想在某个操作中从一个扩展程序重定向到另一个扩展程序。这是我的 bpsmessagecentre 扩展的 bpsmessagecontroller 的 saveAction 中的重定向代码:
$this->redirect('list', 'Coupon', 'Bpscoupons', array('message' => 'Look Ma, no syntax errors!' ));
当运行时,它只是重定向回调用扩展程序(bpsmessagecenter)的列表页面,它似乎根本找不到 Bpscoupons 扩展程序。
当我尝试使用转发调用而不是重定向相同的代码时,我收到 500 错误。
“列表”操作可以通过网站上的链接以及 bpscoupons 扩展内的其他一些重定向来访问和工作。
为什么重定向不起作用?我必须在某处配置有关内部或外部重定向的内容吗?
我正在使用typo3 4.5.32。 谢谢
PS,顺便说一句,在我的查询字符串中,我看到我得到了这些参数:
tx_bpscoupons_bpsmessagecentre[message]:Hi ma... etc
tx_bpscoupons_bpsmessagecentre[action]:list
tx_bpscoupons_bpsmessagecentre[controller]:Coupon
在我看来,它正在寻找 bpsmessagecentre 对象和 bpscoupons 对象,但我不知道。
最佳答案
这两个插件在同一页面上吗?如果不是这种情况,您还必须传递目标页面的 PageId,因为 extbase Controller 中的 $this->redirect 采用以下参数:
/**
* 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
)
我认为扩展名应该以小写字母开头。
关于redirect - 这段代码中我的 $this->redirect(...) 调用有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21562579/