Siropu Well-known member Aug 31, 2017 #1 For example, in a non controller class? Or in a template? Is there a way to do that?
Liam W in memoriam 1998-2020 Aug 31, 2017 #2 I can't see anything that'll let you get it directly (the route match doesn't seem to be stored anywhere), but this works: PHP: \XF::app()->router()->routeToController(\XF::app()->request()->getRoutePath()); (The XF class is available in templates) Liam
I can't see anything that'll let you get it directly (the route match doesn't seem to be stored anywhere), but this works: PHP: \XF::app()->router()->routeToController(\XF::app()->request()->getRoutePath()); (The XF class is available in templates) Liam
Mike XenForo developer Staff member Aug 31, 2017 #3 It's part of the AbstractReply object, but it's not likely to be directly exposed in most cases. You'd likely need to trigger some code somewhere where the reply object is available (and complete).
It's part of the AbstractReply object, but it's not likely to be directly exposed in most cases. You'd likely need to trigger some code somewhere where the reply object is available (and complete).
Siropu Well-known member Sep 1, 2017 #4 Liam W said: PHP: \XF::app()->router()->routeToController(\XF::app()->request()->getRoutePath()); Click to expand... This indeed works. You just have to use the getController() method to get the controller name. Thank you.
Liam W said: PHP: \XF::app()->router()->routeToController(\XF::app()->request()->getRoutePath()); Click to expand... This indeed works. You just have to use the getController() method to get the controller name. Thank you.