Skip to content

CI_Output

Mathieu Nayrolles edited this page Jan 20, 2016 · 1 revision

CI_Output

Output Class

Responsible for sending final output to the browser.

  • Class name: CI_Output
  • Namespace:

Properties

$final_output

public string $final_output

Final output string

  • Visibility: public

$cache_expiration

public integer $cache_expiration

Cache expiration time

  • Visibility: public

$headers

public array $headers = array()

List of server headers

  • Visibility: public

$mimes

public array $mimes = array()

List of mime types

  • Visibility: public

$mime_type

protected string $mime_type = 'text/html'

Mime-type for the current page

  • Visibility: protected

$enable_profiler

public boolean $enable_profiler = FALSE

Enable Profiler flag

  • Visibility: public

$_zlib_oc

protected boolean $_zlib_oc = FALSE

php.ini zlib.output_compression flag

  • Visibility: protected

$_compress_output

protected boolean $_compress_output = FALSE

CI output compression flag

  • Visibility: protected

$_profiler_sections

protected array $_profiler_sections = array()

List of profiler sections

  • Visibility: protected

$parse_exec_vars

public boolean $parse_exec_vars = TRUE

Parse markers flag

Whether or not to parse variables like {elapsed_time} and {memory_usage}.

  • Visibility: public

Methods

__construct

void CI_Output::__construct()

Class constructor

Determines whether zLib output compression will be used.

  • Visibility: public

get_output

string CI_Output::get_output()

Get Output

Returns the current output string.

  • Visibility: public

set_output

\CI_Output CI_Output::set_output(string $output)

Set Output

Sets the output string.

  • Visibility: public

Arguments

  • $output string - <p>Output data</p>

append_output

\CI_Output CI_Output::append_output(string $output)

Append Output

Appends data onto the output string.

  • Visibility: public

Arguments

  • $output string - <p>Data to append</p>

set_header

\CI_Output CI_Output::set_header(string $header, boolean $replace)

Set Header

Lets you set a server header which will be sent with the final output.

Note: If a file is cached, headers will not be sent.

  • Visibility: public

Arguments

  • $header string - <p>Header</p>
  • $replace boolean - <p>Whether to replace the old header value, if already set</p>

set_content_type

\CI_Output CI_Output::set_content_type(string $mime_type, string $charset)

Set Content-Type Header

  • Visibility: public

Arguments

  • $mime_type string - <p>Extension of the file we're outputting</p>
  • $charset string - <p>Character set (default: NULL)</p>

get_content_type

string CI_Output::get_content_type()

Get Current Content-Type Header

  • Visibility: public

get_header

string CI_Output::get_header($header)

Get Header

  • Visibility: public

Arguments

  • $header mixed

set_status_header

\CI_Output CI_Output::set_status_header(integer $code, string $text)

Set HTTP Status Header

As of version 1.7.2, this is an alias for common function set_status_header().

  • Visibility: public

Arguments

  • $code integer - <p>Status code (default: 200)</p>
  • $text string - <p>Optional message</p>

enable_profiler

\CI_Output CI_Output::enable_profiler(boolean $val)

Enable/disable Profiler

  • Visibility: public

Arguments

  • $val boolean - <p>TRUE to enable or FALSE to disable</p>

set_profiler_sections

\CI_Output CI_Output::set_profiler_sections(array $sections)

Set Profiler Sections

Allows override of default/config settings for Profiler section display.

  • Visibility: public

Arguments

  • $sections array - <p>Profiler sections</p>

cache

\CI_Output CI_Output::cache(integer $time)

Set Cache

  • Visibility: public

Arguments

  • $time integer - <p>Cache expiration time in seconds</p>

_display

void CI_Output::_display(string $output)

Display Output

Processes and sends finalized output data to the browser along with any server headers and profile data. It also stops benchmark timers so the page rendering speed and memory usage can be shown.

Note: All "view" data is automatically put into $this->final_output by controller class.

  • Visibility: public

Arguments

  • $output string - <p>Output data override</p>

_write_cache

void CI_Output::_write_cache(string $output)

Write Cache

  • Visibility: public

Arguments

  • $output string - <p>Output data to cache</p>

_display_cache

boolean CI_Output::_display_cache($CFG, $URI)

Update/serve cached output

  • Visibility: public

Arguments

  • $CFG mixed
  • $URI mixed

delete_cache

boolean CI_Output::delete_cache(string $uri)

Delete cache

  • Visibility: public

Arguments

  • $uri string - <p>URI string</p>

set_cache_header

void CI_Output::set_cache_header(integer $last_modified, integer $expiration)

Set Cache Header

Set the HTTP headers to match the server-side file cache settings in order to reduce bandwidth.

  • Visibility: public

Arguments

  • $last_modified integer - <p>Timestamp of when the page was last modified</p>
  • $expiration integer - <p>Timestamp of when should the requested page expire from cache</p>
Clone this wiki locally