PHP Includes?

So Ive given the template Hooks a go and have run into an error when adding the code event listener "Please enter a valid callback method."

I have looked at tutorials and checked my path to the php class file and can't work out whats wrong.

This is what I have done so far:

Popped the forum in debug mode.

Created a php file called plugin.php and placed it in xenforum/library/php/include/plugin.php

The file looks like this:

Code:
class php_include_plugin
{
    public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
        if($hookName == 'include_php')
        {
            ob_start();
            require_once('../my_include.php');
            $contents .= ob_get_contents();
            ob_end_clean();
        }
    }
}


Checked the permissions on the file and folders were correct

Now Ive gone to admin>create add-on
and Ive created an add on called 'include_php'

Now I go to admin>development>Code event listener

And clicked on create new listener and set the options as follows:

Listen to event: template_hook

Execute Call back: php_include_plugin::templateHook

Description: PHP Include

Add on: include_php

When I save I get Please enter a valid callback method. So somethings not tying up but I can't work out what it is
 
Fixed silly typo in the function call templateHook (I have now amended it above), amazing how I spend over an hour trying to work it out, then as soon as I see it all written out on the post its so obvious!!! :rolleyes: So thanks this thread has helped me even if no one replied :D
So refreshing to have a system that I can make edits to without effecting the basic forum structure. Will make my life so much easier for updates!
 
Top Bottom