SilverStripe 3.1+ 动态创建页面重定向

SilverStripe 3.1+ Dynamically creating page redirects

我有一个页面类型 'ProductPage',它有这样导航的标签:

/ProductPageUrlSegment/?tab=video

/ProductPageUrlSegment/?tab=音频

/ProductPageUrlSegment/?tab=照片

我希望在创建每个新产品页面时创建重定向,这样如果您导航 /ProductPageUrlSegment/video 它会转到 / ProductPageUrlSegment/?tab=video

所有选项卡都一样。我不清楚我是否应该使用路由 https://docs.silverstripe.org/en/3.3/developer_guides/controllers/routing/ or redirection https://docs.silverstripe.org/en/3.3/developer_guides/controllers/redirection/

我有另一个项目的 link 功能,该功能转到父页面

public function Link() {
    return $this->Parent()->Link() . '#' . $this->URLSegment;
}

我的应该是这样的:

public function LinkVideo() {
    return $this->Link()->'/?=video' . '#' . $this->URLSegment->'/video';
}

我不具备解决此问题的知识,因此不胜感激任何指导。

这将实现上述目标,方法是将 URL 作为一个操作处理,然后重定向到同一页面,但设置了 get 变量...

class ProductPage extends Page {

}

class ProductPage_Controller extends Page_Controller {

    private static $allowed_actions = array(
        'video',
        'audio',
        'photos',
    );

    public function video() {
         $this->redirect($this->Link().'?tab=video');
    }
    public function audio() {
        $this->redirect($this->Link().'?tab=audio');
    }
    public function photos() {
        $this->redirect($this->Link().'?tab=photos');
    }
}