Jaxel Well-known member Dec 17, 2017 #1 $this->buildLink('threads', $thread) will assume the context of whatever area you are in... how can I force it to go to an admin/public area instead?
$this->buildLink('threads', $thread) will assume the context of whatever area you are in... how can I force it to go to an admin/public area instead?
LPH Well-known member Dec 17, 2017 #2 I suspect passing $router. From the Docs: Code: public static function homePageUrl(&$homePageUrl, \XF\Mvc\Router $router) { $homePageUrl = $router->buildLink('canonical:portal'); }
I suspect passing $router. From the Docs: Code: public static function homePageUrl(&$homePageUrl, \XF\Mvc\Router $router) { $homePageUrl = $router->buildLink('canonical:portal'); }
Jaxel Well-known member Dec 17, 2017 #4 I think I figured something out: Code: $router = \XF::app()['router.admin']; return $this->redirect($router->buildLink('ewr-porta/articles')); There has got to be a simply way though...
I think I figured something out: Code: $router = \XF::app()['router.admin']; return $this->redirect($router->buildLink('ewr-porta/articles')); There has got to be a simply way though...
LPH Well-known member Dec 17, 2017 #5 Would this work? $this->router('admin')->buildLink('ewr-porta/articles') another option Code: return \XF::app()->router('admin')->buildLink('ewr-porta/articles'); Last edited: Dec 17, 2017
Would this work? $this->router('admin')->buildLink('ewr-porta/articles') another option Code: return \XF::app()->router('admin')->buildLink('ewr-porta/articles');
Kier XenForo developer Staff member Dec 17, 2017 #6 Pretty sure you can use link(‘admin:tools/whatever’) or link(‘public:something’)
Jaxel Well-known member Dec 17, 2017 #7 Kier said: Pretty sure you can use link(‘admin:tools/whatever’) or link(‘public:something’) Click to expand... That worked in XF1... doesn't appear to work in XF2 though.
Kier said: Pretty sure you can use link(‘admin:tools/whatever’) or link(‘public:something’) Click to expand... That worked in XF1... doesn't appear to work in XF2 though.
Jaxel Well-known member Dec 17, 2017 #8 Kier said: Pretty sure you can use link(‘admin:tools/whatever’) or link(‘public:something’) Click to expand... In templates, I am using {{ linkType('admin', 'whatever') }}
Kier said: Pretty sure you can use link(‘admin:tools/whatever’) or link(‘public:something’) Click to expand... In templates, I am using {{ linkType('admin', 'whatever') }}
kahovn Member Aug 21, 2019 #9 With xenforo 2, other case: XF::start($dir); $app = XF::setupApp('XF\Pub\App'); $app->start(); $router = $app->router(); $router->buildLink('threads', $thread)
With xenforo 2, other case: XF::start($dir); $app = XF::setupApp('XF\Pub\App'); $app->start(); $router = $app->router(); $router->buildLink('threads', $thread)