Manual:OutputPage.php

Details
Hold HTML and wikitext parsing. Will also generate the  element for non-SkinTemplate skins or part of it for SkinTemplate based skins.

An instance of this class is located in $wgOut.

Output HTML

 * function output, called from function finalCleanup in Wiki.php. It calls function outputPage in Skin.php.
 * function out, called from function outputPage in Skin.php a number of times, to send the HTML to the user: $mBodytext and HTML before and after it.

Generate HTML

 * function addPrimaryWikiText (deprecated, use ) which:
 * applies function parse in Parser.php to the wikitext $text, resulting in the HTML text $text
 * applies function addParserOutput to the HTML text $text, which:
 * applies function addHTML to $text, which appends $text to $mBodytext.
 * function addWikiText which parse wikitext and add it to the HTML stored in that object. There are also variants of this function to choose the Title used to parse the wikitext or to choose whether the html should be parsed with HTML tidy.
 * function addWikiMsg (since 1.12.0) which adds the content of the message to the HTML after parsing it.
 * prependHTML($text): prepend $text (HTML) to the body HTML.

JavaScript and CSS

 * addJsConfigVars($keys,[$value]): adds one or more variables to be set in mw.config in JavaScript. $keys can be an array of key/value pairs. If $keys is a string it is used as key and $value must be set to the value.
 * addInlineScript($script): add a self-contained script tag with the given contents.
 * addInlineStyle($style_css, [$flip]): adds inline CSS styles. Set $flip to 'flip' to flip the CSS if needed (for RTL support). Defaults to 'noflip'.
 * addModuleScripts($modules): Add only JS of one or more modules recognized by the Resource Loader. Module scripts added through this function will be loaded by the resource loader when the page loads. $modules can be a module name (string) or an array of module names.
 * addModuleStyles($modules): The same, but for CSS.
 * disallowUserJs: do not allow scripts which can be modified by wiki users to load on this page: only allow scripts bundled with, or generated by, the software. For security reasons scripts which can be modified by users should not be loaded on some pages, for example a login page.

Other functions

 * setTitle($title): set the title to use to the Title object $title.
 * setPageTitle($name): sets the contents of &lt;h1&gt; and &lt;title&gt; to $name. $name can either be a String or a Message object. When $name is a Message object, the text of this message is used.
 * getPageTitle: gets the page title (the contents of &lt;h1&gt; and &lt;title&gt;) as string.
 * setHTMLTitle($name): set the contents of &lt;title&gt;. It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file.
 * setRobotPolicy($policy): sets the robot policy for the page. See http://www.robotstxt.org/meta.html.
 * redirect($url, [$responsecode]): redirect to $url rather than displaying the normal page. $responsecode defaults to 302.
 * getRedirect: get the URL to redirect to, or an empty string if not redirect URL set.
 * addHeadItem($name, $value): sets a HEAD item.
 * addKeyword($text): adds one (if $text is a string) or more (if $text is an array) keywords to the page header.
 * addReturnTo($title, [$query, $text]): adds a "return to" link pointing to a specified title. $title is the Title object to link to. $query is an optional query string and $text the text of the link (input is not escaped).
 * addTemplate($template): adds the output of a QuickTemplate to the output buffer.
 * allowClickjacking: turn off frame-breaking. See Clickjacking.
 * debug($text): Adds $text to the debug output.
 * getCategories: get the list of category names this page belongs to.
 * isArticle: is the content of the displayed page related to the source of the corresponding article on the wiki?
 * isArticleRelated: is this page related to an article on the wiki?
 * setSquidMaxage($maxage): set the value of the "s-maxage" part of the "Cache-control" HTTP header. $maxages is the maximum cache time on the Squid, in seconds.