Book Image

MediaWiki Skins Design

Book Image

MediaWiki Skins Design

Overview of this book

Table of Contents (16 chapters)
MediaWiki Skins Design
Credits
About the Author
About the Reviewer
Preface

PHP Functions and MediaWiki Functions


PHP functions are built-in functions of the PHP language. For example, the str_replace function allows you to replace one substring with another, within a string.

MediaWiki functions extend the PHP functions in a way that is helpful for your MediaWiki wiki. Some of these are in the SkinTemplate.php file in the includes directory, and there are yet more functions in the Skins.php file in the same directory.

Using MediaWiki Functions

To get data from MediaWiki to your page, there are two steps:

  • Retrieving the data, via a function or a variable

  • Formatting the data in a suitable format

Retrieving the Data

Before we can do anything with the information, we need to retrieve it, be it from a variable, or from a function.

Retrieving Data from a Variable

To retrieve data from a variable, you can just call it in your skin template. For example, to retrieve the data within the variable "var" from the object "Object", all you need to do is this:

$Object['var']

Although...