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

Header to include, please help

gordy

Well-known member
#1
All I want to do is include a header. I just want XF to match my site. I want to think I have chosen wisely.

Listeners, and Controllers, and Call Backs, Oh My!

I've tried this thread but it fails to mention the kind of controller to use
http://xenforo.com/community/threads/can-you-do-a-php-include-in-a-template.7628/#post-107056

Doesn't mention the controller..
http://xenforo.com/community/threads/creating-a-page.5714/page-3

Doesn't mention which Method to use..
http://xenforo.com/community/threads/how-to-access-container_public_params-in-templates.7560/

Seriously, why can't there be a file system php file that I can simply add a <?php include('blah.php') ?> on to.

Trying the above links, and a weeks worth of evenings I'm recieving these errors:

Code:
An exception occurred: Argument 1 passed to XenForo_pF_header::includeFile() must be an instance of XenForo_ControllerPublic_Abstract, array given in /home/webhosts/pf/htdocs/community/library/XenForo/pF/header.php on line 4

XenForo_Application::handlePhpError() in XenForo/pF/header.php at line 4
XenForo_pF_header::includeFile()
call_user_func_array() in XenForo/CodeEvent.php at line 54
XenForo_CodeEvent::fire() in XenForo/Dependencies/Public.php at line 303
XenForo_Dependencies_Public->getEffectiveContainerParams() in XenForo/FrontController.php at line 563
XenForo_FrontController->renderView() in XenForo/FrontController.php at line 156
XenForo_FrontController->run() in /home/webhosts/pf/htdocs/community/index.php at line 13
And also these:
Code:
Template Errors: forum_list
Argument 1 passed to XenForo_pF_header::includeFile() must be an instance of XenForo_ControllerPublic_Abstract, string given in /home/webhosts/pf/htdocs/community/library/XenForo/pF/header.php, line 4:
3: $__extraData['h1'] .= htmlspecialchars($xenOptions['boardTitle']);
4: $__output .= '
5:
Argument 2 passed to XenForo_pF_header::includeFile() must be an instance of XenForo_ControllerResponse_Abstract, string given in /home/webhosts/pf.com/htdocs/community/library/XenForo/pF/header.php, line 4:
3: $__extraData['h1'] .= htmlspecialchars($xenOptions['boardTitle']);
4: $__output .= '
5:
--snip--
18: {
19: $__compilerVar1 .= $title . ' | ' . htmlspecialchars($xenOptions['boardTitle']);
Attempt to assign property of non-object in /home/webhosts/pf/htdocs/community/library/XenForo/pF/header.php, line 15:
14: $__compilerVar1 .= '
15:
Here is what I have:

1 file-system file $HOME/library/XenForo/pF/header.php

Code:
<?php
class XenForo_pF_header
{
    public static function includeFile(XenForo_ControllerPublic_Abstract  $controller, XenForo_ControllerResponse_Abstract &$response)
    {
        ob_start();
        require('/home/webhosts/pf/htdocs/src/header-new2.php');
        $myContent = ob_get_contents();
        ob_end_clean();

        $params = array(
            'myContent'  => $myContent
        );

        $response->params = array_merge(
            $response->params,
            $params
        );

    }
}
2
Code Event Listener

XenForo_pF_header :: includeFile

3
Add-on

Add-on ID: pfHeader

4
Template: header

Code:
<xen:hook name="header">
{xen:raw $myContent}
<div id="header">
    <xen:include template="logo_block" />
    <xen:include template="navigation" />
    <xen:if is="{$canSearch}"><xen:include template="search_bar" /></xen:if>
</div>
</xen:hook>
Any help would be most appreciated :)