Manual:QuickTemplate.php/en


 * Maybe you were looking for help on wiki templates instead?

The QuickTemplate class separates the front-end user interface (UI) from backend stuff. It has an abstract  function which shows the actual HTML of the page. The  class, which is the parent class of most skins, sets up a QuickTemplate instance with many key-value pairs, such as 'articlepath', 'loggedin', and 'titletxt', and invokes.

Most skins define their own template class that extends  which extends  ;   defines additional useful functions for skins, such as ,  , etc.

Using QuickTemplate in extensions
Let's say that you're writing a new special page with a pretty UI and all that. It can prove quite difficult to do that with MediaWiki's  and   classes. It is possible to use  in such cases.

MySpecialPage.php
You need to register the template class with MediaWiki's autoloader in your extension's setup file.

MySpecialPageTemplate.php
We can use  in the template class, because   is a reference to the SpecialMySpecialPage object which extends the SpecialPage class (and SpecialPage class has the   method, which in turn returns a Title object, and the   is a Title method).

Historical background
Ages ago, MediaWiki's skins weren't purely PHP, they required PHPTal. When Brion Vibber rewrote the skin system to remove PHPTal dependency,  and   classes were introduced. The QuickTemplate class became a "generic wrapper for template functions, with interface compatible with what we use of PHPTAL 0.7".