Extension:Simple Article Count

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
Simple Article Count
Release status: stable
Description Displays the article count ({{NUMBEROFARTICLES}}) at the bottom of every page. Requires skin hacking (and thus, core hacking).
Author(s) Max Lee (zedomaxtalk)
Latest version 0.1
MediaWiki 1.11.0
License No license specified
Download Download Count.php
Translate the Simple Article Count extension if it is available at translatewiki.net
Check usage and version matrix.

What can this extension do?[edit]

This is a simple article count extension that you can place anywhere on your skin template by adding the following piece of code:

<?php wfRunHooks('count'); ?>

I made it so I can put it anywhere on my template outside the editing area or the main content area.

You can put it on your header or whatever.

You can do this in your content like this:

{{NUMBEROFARTICLES}} 

But that's if you want it inside your content.

If you want it to show up everywhere, you will need something like this.

Usage[edit]

You get a nice message like, "1000 articles and counting...".

You can change the message simply by changing the text.

Download instructions[edit]

Please cut and paste the code found below and place it in $IP/extensions/SimpleArticleCount/Count.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation[edit]

To install this extension, add the following to LocalSettings.php:

require_once("$IP/extensions/SimpleArticleCount/Count.php");

Code[edit]

<?php
/**
 * Simple Article Count extension
 *
 * @author Max Lee
 * @version 0.1
 * @link http://www.mediawiki.org/wiki/Extension:Simple_Article_Count
 */

//Extension credits that show up on Special:Version
$wgExtensionCredits['other'][] = array(
	'name' => 'Simple Article Count',
	'author' => 'Max Lee',
	'url' => 'http://www.mediawiki.org/wiki/Extension:Simple_Article_Count',
	'version' => '0.1',
	'description' => 'Simple Article Count extension for MediaWiki',
);

$wgHooks['count'][] = 'wfCount';

function wfCount() {
	global $wgOut;

	$out = $wgOut->parse("{{NUMBEROFARTICLES}} articles and counting...");
	echo $out;
	return true;
}

See also[edit]

You can find the sources and other extensions at Zedomax.com Wiki or on my user page.

Sites using this plugin[edit]

  • SiteHoppin.com - A wiki based web 2.5 social networking system in development.
  • Vectrex Wiki - A wiki dedicated to the most unusual Home Arcade System ever...