Thanks for your reply but unfortunately I'm still not there
.
Perhaps if I go through what you did line by line it'll identify where the gaps or errors in my knowledge are and then hopefully highlight where I'm going wrong.
For the first file, library/whatever/EventListener/Listener.php;
Code:
class Dark_Sidebar_EventListener_Listener
This just gives your action a name so that you can refer to it and it's defined by the location and name of your php file, so in this example it'd be library/Dark/Sidebar/EventListener/Listener.php.
Code:
public static function listen($class, array &$extend)
This is saying, "listen" for when a class (effectively the php file) is called, and when it is, "extend" or bolt onto it my array.
Code:
if ($class == 'XenForo_ControllerPublic_Index')
This is the class we're listening out for....
Code:
$extend[] = 'Dark_Sidebar_ControllerPublic_Index';
...and this is the class (library/Dark/Sidebar/ControllerPublic/Index.php) we're also going to include whenever XenForo_ControllerPublic_Index is called.
----------------
For the second file, library/whatever/ControllerPublic/Listener.php (I assume Listener is a typo and it should actually be Index.php, as given by the class name below?)
Code:
class Dark_Sidebar_ControllerPublic_Index extends XFCP_Dark_Sidebar_ControllerPublic_Index
I don't understand the latter part of this, where does
XFCP_Dark_Sidebar_ControllerPublic_Index come from? Why it isn't simply
XenForo_ControllerPublic_Index (as this is what we said we were looking out for in the previous "listener")?.
Code:
public function actionIndex()
$response = parent::actionIndex();
Don't understand this bit at all.
Code:
if ($response instanceof XenForo_ControllerResponse_View)
I assume
library/XenForo/ControllerResponse/View.php is used when someone is viewing the forum list, a thread, someone's user profile etc. (basically anywhere a user can view on your site), and this is why this is here?
Code:
$servers = "my variable";
Here we're defining our variable, the physical output on the template should be
my variable.
Code:
$response->params += array(
Is this saying if the "listen" parameters (or conditions) are true, then I want to add on (ie. my
response is) the following defined arrays...
...I don't really know why this step is necessary, just that it is. Each variable that you want to use has to be defined in this way, it's name in single quotations which you say is equivalent to it's name with the $ (and is is this $name you use in your templates).
This is just saying execute (return) what I have defined as my response, if the listen conditions are met.
---------------
I'm also not entirely sure what you mean by forum index, is this the fourm_list template (and if it is, why does it not appear anywhere in the above code)?
Thanks again for your help and hopefully it's just something simple that I'm not quite grasping to be able to get this to work for me.