Part of the EllisLab Network

Bug Report

$this->output in display_override Hook

Date: 05/11/2008 Severity: Minor
Status: Resolved Reporter: Stuart Marsh
Version: 1.6.1
Keywords: User Guide
Forum Thread: 78278

Description

The user guide states you can use $this->output->get_output() in a display_override hook but this doesn’t work.
The error given is
Message: Undefined property: Display_Hook::$output
Call to a member function _display() on a non-object

Code Sample

class display_hook {
    
    
function NewOutput()
    
{
        $content
= $this->output->get_output();        
    
}
}

Expected Result

Actual Result

Message: Undefined property: Display_Hook::$output
Call to a member function _display() on a non-object

Comment on Bug Report

Page 1 of 1 pages
Posted by: Derek Jones on 11 May 2008 3:10pm
Derek Jones's avatar

Good catch, Stuart, you’ll need to either reference the global $OUT variable, or fetch the CI superobject with get_instance():

class display_hook {

    
function NewOutput()
    
{
        $this
->CI =& get_instance();
        
$content = $this->CI->output->get_output();        
    
}
}

Name:

Email:

Location:

URL:

Remember my personal information

Notify me of follow-up comments?