Simple Article Count

From Zedomax Wiki

Jump to: navigation, search

Extension

Contents

What can this extension do?

This is a simple article count extension that you can place anywhere on your 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

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

You can change the message simply by changing the text.

Download instructions

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

Installation

To install this extension, add the following to LocalSettings.php: <source lang="php">

  1. add configuration parameters here
  2. setup user rights here

require_once("$IP/extensions/count.php"); </source>

Configuration parameters

User rights

Code

count.php

<?php
$wgExtensionCredits['parserhook'][] = array(
'name' => 'Simple Article Count Extension - 12/30/2007',
'author' => 'Max Lee http://zedomax.com',
'url' => 'http://zedomax.com/wiki',
'version' => 'v.0.1',
'description' => 'Simple Article Count Extension for MediaWiki',
);

$wgHooks['count'][] = array("wfCount");



function wfCount() {
        global $wgOut;

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


?>

See also

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

Sites using this plugin

SiteHoppin.com - A wiki based web 2.5 social networking system in development.

Personal tools