MediaWiki master
|
PHP-based skin template that holds data. More...
Inherited by BaseTemplate.
Public Member Functions | |
__construct (Config $config=null) | |
deprecate (string $name, string $version) | |
Sets a template key as deprecated. | |
execute () | |
Main function, used by classes that subclass QuickTemplate to show the actual HTML output. | |
extend ( $name, $value) | |
extends the value of data with name $name with the value $value | |
get ( $name, $default=null) | |
Gets the template data requested. | |
getHTML () | |
Fetch the output of a QuickTemplate and return it. | |
getSkin () | |
Get the Skin object related to this object. | |
html ( $str) | |
msg ( $msgKey) | |
set ( $name, $value) | |
Sets the value $value to $name. | |
Public Attributes | |
array | $data |
Protected Member Functions | |
haveMsg ( $msgKey) | |
text ( $str) | |
Protected Attributes | |
Config | $config |
PHP-based skin template that holds data.
Modern usage with returned output:
class MyTemplate extends QuickTemplate { public function execute() { $html = 'Hello, ' . Html::element( 'strong', [], $this->get( 'name' ) ); echo $html; } } $tpl = new MyTemplate(); $tpl->set( 'name', 'World' ); $output = $tpl->getHTML();
Classic usage with native HTML echo:
class MyTemplate extends QuickTemplate { public function execute() { ?> Hello, <strong><?php $this->text( 'name' ); ?></strong> <?php } } $tpl = new MyTemplate(); $tpl->set( 'name', 'World' ); $tpl->execute(); // echo output
QuickTemplate was originally developed as drop-in replacement for PHPTAL 0.7 (http://phptal.org/).
Definition at line 61 of file QuickTemplate.php.
QuickTemplate::__construct | ( | Config | $config = null | ) |
Config | null | $config |
Definition at line 78 of file QuickTemplate.php.
QuickTemplate::deprecate | ( | string | $name, |
string | $version ) |
Sets a template key as deprecated.
string | $name | |
string | $version | When it was deprecated e.g. 1.38 |
Definition at line 94 of file QuickTemplate.php.
|
abstract |
Main function, used by classes that subclass QuickTemplate to show the actual HTML output.
Referenced by getHTML().
QuickTemplate::extend | ( | $name, | |
$value ) |
extends the value of data with name $name with the value $value
string | $name | |
mixed | $value |
Definition at line 113 of file QuickTemplate.php.
QuickTemplate::get | ( | $name, | |
$default = null ) |
Gets the template data requested.
string | $name | Key for the data |
mixed | null | $default | Optional default (or null) |
Definition at line 144 of file QuickTemplate.php.
QuickTemplate::getHTML | ( | ) |
Fetch the output of a QuickTemplate and return it.
Definition at line 213 of file QuickTemplate.php.
References execute().
QuickTemplate::getSkin | ( | ) |
Get the Skin object related to this object.
Definition at line 203 of file QuickTemplate.php.
Referenced by BaseTemplate\getFooter(), BaseTemplate\getMsg(), BaseTemplate\getPersonalTools(), BaseTemplate\getSidebar(), BaseTemplate\makeLink(), BaseTemplate\makeListItem(), BaseTemplate\makeSearchButton(), and BaseTemplate\makeSearchInput().
|
protected |
string | $msgKey |
Definition at line 193 of file QuickTemplate.php.
References wfMessage().
QuickTemplate::html | ( | $str | ) |
string | $str |
Definition at line 168 of file QuickTemplate.php.
QuickTemplate::msg | ( | $msgKey | ) |
string | $msgKey |
Reimplemented in BaseTemplate.
Definition at line 176 of file QuickTemplate.php.
References text(), and wfMessage().
QuickTemplate::set | ( | $name, | |
$value ) |
Sets the value $value to $name.
string | $name | |
mixed | $value |
Definition at line 103 of file QuickTemplate.php.
|
protected |
|
protected |
Definition at line 70 of file QuickTemplate.php.
Referenced by __construct().
array QuickTemplate::$data |
Definition at line 67 of file QuickTemplate.php.