MediaWiki/content programming: Difference between revisions

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
just some stuff from DPL, to start with
 
some stuff from MW doc
Line 2: Line 2:
[[MediaWiki]]'s built-in features already allow some simple dynamic text management and manipulation; with the addition of various extensions, much more sophisticated tasks can be accomplished, making MediaWiki into a sort of "swiss army knife" [[content manager]] application.
[[MediaWiki]]'s built-in features already allow some simple dynamic text management and manipulation; with the addition of various extensions, much more sophisticated tasks can be accomplished, making MediaWiki into a sort of "swiss army knife" [[content manager]] application.
===Information===
===Information===
How to get various bits of information about any given page
How to get various bits of information about stuff
{|
{|
|-
|-
| '''Title'''
| '''Date/Time'''
|-
| Year || MW: <nowiki>{{CURRENTYEAR}}</nowiki> || {{CURRENTYEAR}}
|-
| rowspan=4 | Month
| MW: <nowiki>{{CURRENTMONTH}}</nowiki> (zero-padded number)                  || {{CURRENTMONTH}}
|-
| MW: <nowiki>{{CURRENTMONTHNAME}}</nowiki> (name)                            || {{CURRENTMONTHNAME}}
|-
| MW: <nowiki>{{CURRENTMONTHNAMEGEN}}</nowiki> (genitive form)                || {{CURRENTMONTHNAMEGEN}}
|-
| MW: <nowiki>{{CURRENTMONTHABBREV}}</nowiki> (abbreviation; requires MW 1.5+) || {{CURRENTMONTHABBREV}}
|-
| rowspan=2 | Day-of-month
| MW: <nowiki>{{CURRENTDAY}}</nowiki> (unpadded number)               || {{CURRENTDAY}}
|-
| MW: <nowiki>{{CURRENTDAY2}}</nowiki> (zero-padded number; requires MW 1.6+) || {{CURRENTDAY2}}
|-
| rowspan=2 | Day-of-week
| MW: <nowiki>{{CURRENTDOW}}</nowiki> (unpadded number) || {{CURRENTDOW}}
|-
| MW: <nowiki>{{CURRENTDAYNAME}}</nowiki> (name) || {{CURRENTDAYNAME}}
|-
| Week      || MW: <nowiki>{{CURRENTWEEK}}</nowiki> (number)                 || {{CURRENTWEEK}}
|-
| Time: full || MW: <nowiki>{{CURRENTTIME}}</nowiki> (24-hour HH:mm format) || {{CURRENTTIME}}
|-
| Time: hour || MW: <nowiki>{{CURRENTHOUR}}</nowiki> (24-hour zero-padded number) || {{CURRENTHOUR}}
|-
| Timestamp  || MW: <nowiki>{{CURRENTTIMESTAMP}}</nowiki>                          || {{CURRENTTIMESTAMP}}
|-
| '''Page Title'''
|-
|-
| Prefix<br><small>(namespace only)</small> || [[../DPL|DPL]]: %NAMESPACE%
| Prefix<br><small>(namespace only)</small> || [[../DPL|DPL]]: %NAMESPACE%
Line 11: Line 42:
| Suffix<br><small>(without namespace)</small> || DPL: %TITLE%
| Suffix<br><small>(without namespace)</small> || DPL: %TITLE%
|-
|-
| '''Stats'''
| '''Page Stats'''
|-
|-
| Usage counter (hits) || DPL:  %COUNT% (requires addpagecounter=true)
| Usage counter (hits) || DPL:  %COUNT% (requires addpagecounter=true)
Line 28: Line 59:
| Page last editor || DPL:  %USER% (requires adduser=true and ordermethod=lastedit)
| Page last editor || DPL:  %USER% (requires adduser=true and ordermethod=lastedit)
|}
|}
==Sources==
* '''MW''' (built-in): [[mwsite:Help:Magic words|Help:Magic words]]
* '''DPL''': [http://semeb.com/dpldemo/index.php?title=DPL:Manual DPL Manual]
** [http://semeb.com/dpldemo/index.php?title=DPL:Manual_-_DPL_parameters:_Controlling_output_order DPL parameters: Controlling output order]

Revision as of 02:03, 31 July 2008

Overview

MediaWiki's built-in features already allow some simple dynamic text management and manipulation; with the addition of various extensions, much more sophisticated tasks can be accomplished, making MediaWiki into a sort of "swiss army knife" content manager application.

Information

How to get various bits of information about stuff

Date/Time
Year MW: {{CURRENTYEAR}} 2026
Month MW: {{CURRENTMONTH}} (zero-padded number) 07
MW: {{CURRENTMONTHNAME}} (name) July
MW: {{CURRENTMONTHNAMEGEN}} (genitive form) July
MW: {{CURRENTMONTHABBREV}} (abbreviation; requires MW 1.5+) Jul
Day-of-month MW: {{CURRENTDAY}} (unpadded number) 8
MW: {{CURRENTDAY2}} (zero-padded number; requires MW 1.6+) 08
Day-of-week MW: {{CURRENTDOW}} (unpadded number) 3
MW: {{CURRENTDAYNAME}} (name) Wednesday
Week MW: {{CURRENTWEEK}} (number) 28
Time: full MW: {{CURRENTTIME}} (24-hour HH:mm format) 13:04
Time: hour MW: {{CURRENTHOUR}} (24-hour zero-padded number) 13
Timestamp MW: {{CURRENTTIMESTAMP}} 20260708130423
Page Title
Prefix
(namespace only)
DPL: %NAMESPACE%
Suffix
(without namespace)
DPL: %TITLE%
Page Stats
Usage counter (hits) DPL: %COUNT% (requires addpagecounter=true)

DPL: %COUNTFS% = a font size number based on usage counter
DPL: %COUNTFS2% = similar to %COUNTFS%, but log(sqrt(counter))

Page size (bytes) DPL: %SIZE% (requires addpagesize=true)

DPL: %SIZEFS% – font size number based on article size

Creation date DPL: %DATE% (requires addeditdate=true and ordermethod=firstedit)
Last edit date DPL: %DATE% (requires addeditdate=true and ordermethod=lastedit)
Page creator DPL: %USER% (requires adduser=true and ordermethod=firstedit)
Page last editor DPL: %USER% (requires adduser=true and ordermethod=lastedit)

Sources