Manual:OutputPage.php

The   object takes care of generating HTML and other things related to creating a HTML-view of a page.

It 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 .

Output HTML

 * - called from function  in . It calls function   in Skin.php.
 * - called from function  in Skin.php a number of times to send the HTML to the user: $mBodytext and HTML before and after it.

Output

Generate HTML

 * - parses wikitext and adds 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.
 * (since 1.12.0): adds the content of the message to the HTML after parsing it.
 * - prepends $text (HTML) to the body HTML.
 * (deprecated, use ) which:
 * applies function  in  to the wikitext $text, resulting in the HTML text $text
 * applies function  to the HTML text $text, which:
 * applies function  to $text, which appends $text to $mBodytext.

JavaScript and CSS

 * - adds one or more variables to be set in  in JavaScript.   can be an array of key/value pairs. If $keys is a string it is used as key and $value must be set. Using this method is ideal if you have a direct correlation between a module added to the page and information the module needs (e.g. an   call and   go well together). However if you're exporting generic information for a lot (if not, all) pages (in which case you likely don't have a reference to an OutputPage instance) then you should use the MakeGlobalVariablesScript hook instead. To add   variables that are site-wide and do not depend on page or user, then use the ResourceLoaderGetConfigVars hook instead. Though use the latter sparingly as it adds weight to the startup module. Also beware of caching since this (depending on the wiki's cache configuration) this may be only refreshed when the wiki page associated with the OutputPage is modified.
 * - add a self-contained script tag with the given contents.
 * - add a script tag that references a URL. URL should be absolute, protocol-relative or relative to root path.
 * - adds inline CSS styles. Set $flip to 'flip' to flip the CSS if needed (for RTL support). Defaults to 'noflip'.
 * - Add one or more modules recognized by the Resource Loader. Module CSS and JavaScript added through this function will be loaded by the resource loader when the page loads as a combined JavaScript and CSS package, thus the user's browser must enable JavaScript. $modules can be a module name (string) or an array of module names.
 * - Add only CSS of one or more modules recognized by the Resource Loader. Module styles added through this function will be added using standard link CSS tags, rather than as a combined JavaScript and CSS package. Thus, they will load even if the user's browser disables JavaScript (unless the browser also disables CSS). $modules can be a module name (string) or an array of module names.
 * - 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

 * - set the title to use to the Title object $title.
 * - 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.
 * - gets the page title (the contents of &lt;h1&gt; and &lt;title&gt;) as string.
 * - set the contents of &lt;title&gt;. It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file.
 * - sets the robot policy for the page. See http://www.robotstxt.org/meta.html.
 * - redirect to $url rather than displaying the normal page. $responsecode defaults to 302.
 * - get the URL to redirect to, or an empty string if not redirect URL set.
 * - sets a HEAD item.
 * - 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).
 * - adds the output of a to the output buffer.
 * - turn off frame-breaking. See Clickjacking.
 * - Adds $text to the debug output.
 * - get the list of category names this page belongs to.
 * - is the content of the displayed page related to the source of the corresponding article on the wiki?
 * - is this page related to an article on the wiki?
 * - 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.