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)
 
(→‎Information: more magic words)
 
(One intermediate revision by the same user not shown)
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'''
 
|-
 
|-
| Prefix<br><small>(namespace only)</small> || [[../DPL|DPL]]: %NAMESPACE%
+
| Year || MW: <nowiki>{{CURRENTYEAR}}</nowiki> || {{CURRENTYEAR}}
 
|-
 
|-
| Suffix<br><small>(without namespace)</small> || DPL: %TITLE%
+
| rowspan=4 | Month
 +
| MW: <nowiki>{{CURRENTMONTH}}</nowiki> (zero-padded number)                   || {{CURRENTMONTH}}
 
|-
 
|-
| '''Stats'''
+
| 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}}
 +
|-
 +
| '''Site Info'''
 +
|-
 +
| Site's name<br><small>($wgSitename)</small> || MW: <nowiki>{{SITENAME}}</nowiki> || {{SITENAME}}
 +
|-
 +
| MediaWiki version || MW: <nowiki>{{CURRENTVERSION}}</nowiki>                    || {{CURRENTVERSION}}
 +
|-
 +
| Default language<br><small>($wgLanguageCode)</small> || MW: <nowiki>{{CONTENTLANGUAGE}}</nowiki> || {{CONTENTLANGUAGE}}
 +
|-
 +
| # of wiki pages                  || MW: <nowiki>{{NUMBEROFPAGES}}</nowiki>    || {{NUMBEROFPAGES}}
 +
|-
 +
| # of pages in main namespace    || MW: <nowiki>{{NUMBEROFARTICLES}}</nowiki> || {{NUMBEROFARTICLES}}
 +
|-
 +
| # of uploaded files              || MW: <nowiki>{{NUMBEROFFILES}}</nowiki>    || {{NUMBEROFFILES}}
 +
|-
 +
| # of page edits                  || MW: <nowiki>{{NUMBEROFEDITS}}</nowiki>    || {{NUMBEROFEDITS}}
 +
|-
 +
| # of registered users            || MW: <nowiki>{{NUMBEROFUSERS}}</nowiki>    || {{NUMBEROFUSERS}}
 +
|-
 +
| # of sysops                      || MW: <nowiki>{{NUMBEROFADMINS}}</nowiki>  || {{NUMBEROFADMINS}}
 +
|-
 +
| '''Page Title'''
 +
|-
 +
| rowspan=3 | Full Title          || MW: <nowiki>{{FULLPAGENAME}}</nowiki>                      || {{FULLPAGENAME}}
 +
|-
 +
|                                    MW: <nowiki>{{SUBJECTPAGENAME}}</nowiki> - namespace+base || {{SUBJECTPAGENAME}}
 +
|-
 +
|                                    MW: <nowiki>{{TALKPAGENAME}}</nowiki> - talkpage namespace+base || {{TALKPAGENAME}}
 +
|-
 +
| Prefix<br><small>(namespace only)</small>    || [[../DPL|DPL]]: %NAMESPACE%
 +
|-
 +
| rowspan=4 | Suffix<br><small>(without namespace)</small>      || DPL: %TITLE%
 +
|-
 +
| MW: <nowiki>{{PAGENAME}}</nowiki>                              || {{PAGENAME}}
 +
|-
 +
| MW: <nowiki>{{BASEPAGENAME}}</nowiki> - base title, no subpage || {{BASEPAGENAME}}
 +
|-
 +
| MW: <nowiki>{{SUBPAGENAME}}</nowiki> - subpage                || {{SUBPAGENAME}}
 +
|-
 +
| Namespace                        || MW: <nowiki>{{NAMESPACE}}</nowiki>    || {{NAMESPACE}}
 +
|-
 +
| Content namespace                || MW: <nowiki>{{SUBJECTSPACE}}</nowiki> || {{SUBJECTSPACE}}
 +
|-
 +
| Talk namespace                  || MW: <nowiki>{{TALKSPACE}}</nowiki>    || {{TALKSPACE}}
 +
|-
 +
| '''Page Info'''
 
|-
 
|-
 
| Usage counter (hits) || DPL:  %COUNT% (requires addpagecounter=true)
 
| Usage counter (hits) || DPL:  %COUNT% (requires addpagecounter=true)
Line 22: Line 91:
 
| Creation date || DPL: %DATE% (requires addeditdate=true and ordermethod=firstedit)
 
| Creation date || DPL: %DATE% (requires addeditdate=true and ordermethod=firstedit)
 
|-
 
|-
| Last edit date || DPL: %DATE% (requires addeditdate=true and ordermethod=lastedit)
+
| rowspan=6 | Last edit date || DPL: %DATE% (requires addeditdate=true and ordermethod=lastedit)
 +
|-
 +
| MW: <nowiki>{{REVISIONDAY}}</nowiki>: Day edit was made (unpadded number)    || {{REVISIONDAY}}
 +
|-
 +
| MW: <nowiki>{{REVISIONDAY2}}</nowiki>: Day edit was made (zero-padded number) || {{REVISIONDAY2}}
 +
|-
 +
| MW: <nowiki>{{REVISIONMONTH}}</nowiki>: Month edit was made (unpadded number) || {{REVISIONMONTH}}
 +
|-
 +
| MW: <nowiki>{{REVISIONYEAR}}</nowiki>: Year edit was made                    || {{REVISIONYEAR}}
 +
|-
 +
| MW: <nowiki>{{REVISIONTIMESTAMP}}</nowiki>: Timestamp as of time of edit      || {{REVISIONTIMESTAMP}}
 
|-
 
|-
 
| Page creator || DPL: %USER% (requires adduser=true and ordermethod=firstedit)
 
| Page creator || DPL: %USER% (requires adduser=true and ordermethod=firstedit)
 
|-
 
|-
 
| Page last editor || DPL:  %USER% (requires adduser=true and ordermethod=lastedit)
 
| Page last editor || DPL:  %USER% (requires adduser=true and ordermethod=lastedit)
 +
|-
 +
| Revision ID || MW: <nowiki>{{REVISIONID}}</nowiki> || {{REVISIONID}}
 
|}
 
|}
 +
 +
==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]

Latest revision as of 18:23, 1 August 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) 17:54
Time: hour MW: {{CURRENTHOUR}} (24-hour zero-padded number) 17
Timestamp MW: {{CURRENTTIMESTAMP}} 20250520175446
Site Info
Site's name
($wgSitename)
MW: {{SITENAME}} HTYP
MediaWiki version MW: {{CURRENTVERSION}} 1.35.0
Default language
($wgLanguageCode)
MW: {{CONTENTLANGUAGE}} en
# of wiki pages MW: {{NUMBEROFPAGES}} 5,181
# of pages in main namespace MW: {{NUMBEROFARTICLES}} 2,827
# of uploaded files MW: {{NUMBEROFFILES}} 560
# of page edits MW: {{NUMBEROFEDITS}} 32,260
# of registered users MW: {{NUMBEROFUSERS}} 7,482
# of sysops MW: {{NUMBEROFADMINS}} 3
Page Title
Full Title MW: {{FULLPAGENAME}} MediaWiki/content programming
MW: {{SUBJECTPAGENAME}} - namespace+base MediaWiki/content programming
MW: {{TALKPAGENAME}} - talkpage namespace+base Talk:MediaWiki/content programming
Prefix
(namespace only)
DPL: %NAMESPACE%
Suffix
(without namespace)
DPL: %TITLE%
MW: {{PAGENAME}} MediaWiki/content programming
MW: {{BASEPAGENAME}} - base title, no subpage MediaWiki
MW: {{SUBPAGENAME}} - subpage content programming
Namespace MW: {{NAMESPACE}}
Content namespace MW: {{SUBJECTSPACE}}
Talk namespace MW: {{TALKSPACE}} Talk
Page Info
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)
MW: {{REVISIONDAY}}: Day edit was made (unpadded number) 1
MW: {{REVISIONDAY2}}: Day edit was made (zero-padded number) 01
MW: {{REVISIONMONTH}}: Month edit was made (unpadded number) 08
MW: {{REVISIONYEAR}}: Year edit was made 2008
MW: {{REVISIONTIMESTAMP}}: Timestamp as of time of edit 20080801182318
Page creator DPL: %USER% (requires adduser=true and ordermethod=firstedit)
Page last editor DPL: %USER% (requires adduser=true and ordermethod=lastedit)
Revision ID MW: {{REVISIONID}} 10045

Sources