Difference between revisions of "MediaWiki/content programming"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(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}} 2025
Month MW: {{CURRENTMONTH}} (zero-padded number) 05
MW: {{CURRENTMONTHNAME}} (name) May
MW: {{CURRENTMONTHNAMEGEN}} (genitive form) May
MW: {{CURRENTMONTHABBREV}} (abbreviation; requires MW 1.5+) May
Day-of-month MW: {{CURRENTDAY}} (unpadded number) 20
MW: {{CURRENTDAY2}} (zero-padded number; requires MW 1.6+) 20
Day-of-week MW: {{CURRENTDOW}} (unpadded number) 2
MW: {{CURRENTDAYNAME}} (name) Tuesday
Week MW: {{CURRENTWEEK}} (number) 21
Time: full MW: {{CURRENTTIME}} (24-hour HH:mm format) 13:14
Time: hour MW: {{CURRENTHOUR}} (24-hour zero-padded number) 13
Timestamp MW: {{CURRENTTIMESTAMP}} 20250520131449
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