Open main menu


MediaWiki extensions manual
OOjs UI icon advanced.svg
Release status: unmaintained
Implementation Tag
Description Enables embedding the player in a page with the <lastfm> tag.
Author(s) Guy Taylor (TheBigGuytalk)
Latest version 0.2 (2008-05-20)
Database changes No
License No license specified
Download See the code section
Translate the LastFm extension if it is available at
Check usage and version matrix.

The LastFm extension enables embedding the player in a page with the <lastfm> tag.


Now you can use the extension with <lastfm></lastfm> in the wiki


  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/LastFm/LastFm.php";
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


 * LastFm extension for MediaWiki
 * @author Guy Taylor
 * @copyright © Guy Taylor
 * @version 0.2
 * @link

if ( !defined( 'MEDIAWIKI' ) ) {
	die( 'This is not a valid entry point.' );

// Extension credits that show up on Special:Version
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'LastFm',
        'author' => 'Guy Taylor',
        'version' => '0.2',
        'url' => '',
        'description' => 'Allows to adds the player to a page with the <tt>&lt;lastfm&gt;</tt> tag'

$wgExtensionFunctions[] = 'wfLastFm';

function wfLastFm() {
    global $wgParser;
    $wgParser->setHook( 'lastfm', 'renderLastFm' );

# The callback function for converting the input text to HTML output
function renderLastFm( $input ) {
    $output = "<!-- -->";
    $output = "<a href=\"";
    $output .= htmlspecialchars($input);
    $output .= "/?chartstyle=tracks\">";
    $output .= "<img src=\"";
    $output .= htmlspecialchars($input);
    $output .= ".gif\" border=\"0\" alt=\"";
    $output .= htmlspecialchars($input);
    $output .= "'s Weekly Artists Chart\" /></a>";

    return $output;