Add-on Easy header/footer includer

Dad.

Well-known member
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
 
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.webp

Of course there's a lot you could do aside from that...
 
Absolutely fantastic. I will give this a try tonight thanks again Chris you're as usual a life saver.
 
How safe is it to just place HTML into the header and footer files?
Depending, as safe as anything else. If someone is sending you code, be wary of it, but if you are simply editing the templates you should be fine to do as you need :)
 
Top Bottom