Recently I needed to create a separate page in the help section of the forum running on the XenForo engine. As it turned out, to make it easy. Moreover, it was not necessary to edit the code of the engine itself, which is natural, in the future, when updating the kernel, we will make life easier. At once I will make a reservation that the article is not innovative, but rather a How-To for myself.

So, we need to create only 2
Help.php and
LoadClassController.php files
scattering them respectively in the
ControllerPublic and
Listener folders.
Content Help.php<?php class AnyFolder_ControllerPublic_Help extends XFCP_AnyFolder_ControllerPublic_Help { public function actionYouaction() { return $this->_getWrapper('youaction', $this->responseView('XenForo_ViewPublic_Help_ouaction', 'help_youaction') ); } }
')
Content LoadClassController.php <?php class AnyFolder_Listener_LoadClassController { public static function extendHelpController($class, array &$extend) { if ($class == 'XenForo_ControllerPublic_Help') { $extend[] = 'AnyFolder_ControllerPublic_Help'; } } }
As a result, we should have the following tree of documents
Fill our document tree in the
library folder. Then open the file
config.php in the same folder (
library ) and enable debugging mode by adding there
$config['debug'] = true;
We have turned on debugging mode in order to access the development tab in the admin panel. In this tab, we need to create a new event. To do this, open
Event Handlers →
Create a new event (or immediately open a link in the browser like
http://example.com/path_you_forum/admin.php?code-event-listeners/add ).
Now select the
load_class_controller event,
specify as the handler
AnyFolder_Listener_LoadClassController :: extendHelpController . The rest is left unchanged.
Now it's up to the templates. But before that, I would like to explain a bit the code described above. As you probably already understood,
AnyFolder is the name of your folder. The same name appears in the classroom, which we create and will be our friend in the future. The situation is similar with the
action action function and its parameters
youaction ,
XenForo_ViewPublic_Help_ Show ,
help_ youaction . Thus, we have determined that our page will open at
http://example.com/path_you_forum/help/ youaction (if the CNC is turned on) and
http://example.com/path_you_forum/?help/ youaction . I think it is not necessary to explain what actions need to be done to place the files in a folder with any other name and how to change the URL of your help page.
Well, okay, let's finish with programming and proceed to the layout. To do this, we need to edit just a few templates and add phrases to language packs.
In the
help_wrapper template
, by analogy with other items, add our new
<li><a href="{xen:link help/youaction}" class="{xen:if "{$selected} == 'youaction'", 'secondaryContent', 'primaryContent'}">{xen:phrase youaction}</a></li>
We will do the same with
help_index <dl> <dt><a href="{xen:link help/gude}">{xen:phrase youaction}</a></dt> <dd>{xen:phrase view_text_youaction}</dd> </dl>
Lastly, edit the
navigation pattern by adding your item to the block with the
navigation_tabs_help hook.
<li><a href="{xen:link help/youaction}">{xen:phrase youaction}</a></li>
In the language packs we need to create only 3 phrases:
- view_text_youaction - help point description
- youaction - the title of our help item
- gude_rules_text - html code of our page
We will finish everything by creating a new template
help_youaction (this is the name we have in the
actionYouaction function)
<xen:title>{xen:phrase gude}</xen:title> <div class="baseHtml"> {xen:phrase gude_rules_text} </div>
PS Do not forget to disable the debug mode ;-)