TYPO3 Extbase-重定向到pid [英] TYPO3 Extbase - redirect to pid

查看:88
本文介绍了TYPO3 Extbase-重定向到pid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$GLOBALS['TSFE']->pageNotFoundAndExit('');

当前被使用,但是我想重定向到页面ID.

is currently used, but instead I would like to redirect to a page ID.

使用命令redirectToUri,我找不到解决方案,或者没有解决.

With the command redirectToUri, I could find no solution, or didn't work.

代码:

/**
* initialize action show
* @return void
*/
public function initializeShowAction() {
  if ($this->request->hasArgument('xxx')) {
    if ( $xxx=$this->xxxRepository->findByUid(
      intval($this->request->getArgument('xxx'))
    ) ) {
      $this->request->setArgument('xxx',$xxx);
      return;
    }
  }

$GLOBALS['TSFE']->pageNotFoundAndExit('');

}

推荐答案

您可以在控制器中使用以下代码构建uri:

You can build an uri with the following code in your controller:

$uriBuilder = $this->uriBuilder;
$uri = $uriBuilder
  ->setTargetPageUid($pageUid)
  ->build();
$this->redirectToUri($uri, 0, 404);

这篇关于TYPO3 Extbase-重定向到pid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆