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

Advanced PHP Functions


By looking through the SkinTemplate.php file in your MediaWiki install's directory, you can find lots of useful functions to extend the information you can dynamically insert in your wiki pages.

Global Variables

The SkinTemplate.php file contains "global variables" that you can insert in your wiki page using this simple PHP:

<?php echo
$GLOBALS['name_of_global_variable'];
?>

The echo command inserts the value returned from the $GLOBALS that follows it. The following are the variables you can use:

  • wgTitle inserts the current page's title.

  • wgScript inserts your MediaWiki installation's script path. The script path is the part of the URL before your page title. For example, if your wiki was installed in the directory wiki/ on your website, the script path would be wiki/index.php.

  • wgStylePath inserts your wiki's skins directory.

  • wgContLanguageCode inserts the ISO language code of the content. In most cases, it will be "en" for English.

  • wgMimeType inserts the MIME...