我的$ this->重定向(...)调用此代码有什么问题?

时间:2014-02-04 20:22:25

标签: redirect controller typo3 extbase

我有两个扩展程序,我希望在某个操作中从一个扩展名重定向到另一个。这是我的bpsmessagecentre扩展的bpsmessagecontroller的saveAction中的重定向代码:

 $this->redirect('list', 'Coupon', 'Bpscoupons', array('message' => 'Look Ma, no syntax errors!' ));

当它运行时它只是重定向回调用扩展名(bpsmessagecenter)的列表页面,它似乎根本找不到Bpscoupons扩展名。

当我使用转发呼叫而不是重定向尝试相同的代码时,我收到500错误。

“列表”操作可以访问,并且可以从站点上的链接以及bpscoupons扩展中的其他一些重定向进行操作。

为什么重定向不起作用?有什么内部或外部重定向我必须在某处配置?

我正在使用typo3 4.5.32。 感谢

PS,btw在我的查询字符串中我看到我得到了这些参数:

tx_bpscoupons_bpsmessagecentre[message]:Hi ma... etc
tx_bpscoupons_bpsmessagecentre[action]:list
tx_bpscoupons_bpsmessagecentre[controller]:Coupon 

在我看来它正在寻找一个bpsmessagecentre对象一个bpscoupons对象,但我不知道。

1 个答案:

答案 0 :(得分:3)

这2个插件是否在同一页面上?如果不是这种情况,你也必须传递目标页面的PageId,因为$ this-> extbase conroller中的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
    )

我认为扩展名应以小写字母开头。

相关问题