S S Thomas Well-known member Feb 18, 2018 #1 Is it possible to get the template name in a php script?
Jeremy P XenForo developer Staff member Feb 18, 2018 #4 I take it you're extending an existing controller? PHP: $templateName = $reply->getTemplateName();
S S Thomas Well-known member Feb 18, 2018 #5 Yes, I'm extending the FindNew Controller. Appreciate your help and effort, but that did not work
Jeremy P XenForo developer Staff member Feb 18, 2018 #6 You'll have to be more descript. How didn't it work? Do you get an error? An empty string? Do you have a code sample?
You'll have to be more descript. How didn't it work? Do you get an error? An empty string? Do you have a code sample?
S S Thomas Well-known member Feb 18, 2018 #7 Yes, sorry. So I'm extending XenForo_ControllerPublic_FindNew, changing actionPosts(). There is no $reply declared, so obviously it won't work. I assume that thats something every controller should have in some way?
Yes, sorry. So I'm extending XenForo_ControllerPublic_FindNew, changing actionPosts(). There is no $reply declared, so obviously it won't work. I assume that thats something every controller should have in some way?
Jeremy P XenForo developer Staff member Feb 18, 2018 #8 Oh, I'm sorry, completely missed the 1.5 prefix. The reply is the reply object returned by the parent (or the response in 1.5). PHP: public function actionPosts() { $response = parent::actionPosts(); $templateName = $response->templateName; return $response; }
Oh, I'm sorry, completely missed the 1.5 prefix. The reply is the reply object returned by the parent (or the response in 1.5). PHP: public function actionPosts() { $response = parent::actionPosts(); $templateName = $response->templateName; return $response; }