Hi,
I am not sure if this is a bug or not. When I go to /myroute/slughere/ it works fine (displays the page), but when I remove the trailing slash, it doesn't work (e.g. /myroute/slughere), it says "The requested page could not be found. (Code: invalid_action, controller: My\Addon:MyPage, action: SlugHere)".
In addition, when I go to /myroute/ it works fine, as well as /myroute (even without trailing slash) - however, without the trailing slash, the breadcrumb would show (it doesn't show the MyPage breadcrumb link when there is a trailing slash, just Home):
I noticed that with /forums/, /threads/, ..etc they automatically add the trailing slash when it's not there.
Any help would be appreciated.
Pub\Controller\MyPage.php
Public Route
I am running RC3.
I am not sure if this is a bug or not. When I go to /myroute/slughere/ it works fine (displays the page), but when I remove the trailing slash, it doesn't work (e.g. /myroute/slughere), it says "The requested page could not be found. (Code: invalid_action, controller: My\Addon:MyPage, action: SlugHere)".
In addition, when I go to /myroute/ it works fine, as well as /myroute (even without trailing slash) - however, without the trailing slash, the breadcrumb would show (it doesn't show the MyPage breadcrumb link when there is a trailing slash, just Home):
I noticed that with /forums/, /threads/, ..etc they automatically add the trailing slash when it's not there.
Any help would be appreciated.
Pub\Controller\MyPage.php
Code:
<?php
namespace My\Addon\Pub\Controller;
use XF\Mvc\ParameterBag;
class MyPage extends \XF\Pub\Controller\AbstractController
{
public function actionIndex(ParameterBag $params)
{
if ($params->slug)
{
return $this->rerouteController(__CLASS__, 'Category', $params);
}
$test = 'hello';
$viewParams = ['test' => $test];
return $this->view('My\Addon:MyPage\View', 'my_addon_index', $viewParams);
}
public function actionCategory(ParameterBag $params)
{
$test ='bye';
$viewParams = ['test' => $test];
return $this->view('My\Addon:MyPage\Category', 'my_addon_category', $viewParams);
}
Public Route
I am running RC3.