• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Add-on Easy header/footer includer

Mike Creuzer

Well-known member
#1
Hey all devs!

Looking for a plugin that will allow me to include a file from on the server (or anywhere) and include it in the page with options for a file_get_contents() and include(). I find this to be a very common thing people need to do and it'd be nice if it was in an easy to install plugin form. Not sure if this exists either I havent come across anything in the search at least.

PM me with pricing!

@Chris D @shadrxninga @Waindigo

Thanks,
Mike
 

Chris D

XenForo developer
Staff member
#2
It's more than likely possible with a callback template tag.

This allows you to call a PHP script from a template.

This is the basic usage. Add this to your footer template (or wherever):
HTML:
<xen:callback class="YourAddOn_Callback" method="renderFooter" />
The class name is derived from the file path and file name, so the above would point to a file: library/YourAddOn/Callback.php.

So create that file, with these contents:

PHP:
<?php

class YourAddOn_Callback
{
    public static function renderFooter($content, $params, XenForo_Template_Abstract $template)
    {
        return '<b>Hello Audentio!</b>';
    }
}
End result:

upload_2014-3-13_23-40-19.png

Of course there's a lot you could do aside from that...