Sandbox
feel free to play around
Contents
Playground
You must create valid syntax for the gallery extension if you want to use it within DPL; add debug=5 at the beginning of your statement and check what the Template Template:Infobox Country or territory dpl produces. Gero 10:34, 4 April 2008 (CEST)
1
{{#arraydefine:x|
follow the link in the headline .. ° There was a basic version of this extension some time ago. Later it was enhanced by many new features and the name was changed to DynamicPageList2. The new version was no longer downward compatible. At the same time the name of the original extension was changed to 'Intersection' (but the documentation kept talking of DynamicPageList and the tag name still was <DynamicPageList>).
Some time later another bunch of features had been added. And the name was changed back to DynamicPageList (which was thought to be 'free').
Meanwhile some new features had also been added to 'Intersection' and recently 'Intersection' requested its original name back - which caused a real lot of confusion regarding the naming.
Currently (as of June 2009) the status is as follows:
- Some wikimedia websites like wikinews use the old version. They call it 'Intersection' or 'DynamicPageList'. Its tag is <DynamicPageList> and the sources are in the mediawiki SVN under the path name 'DynamicPageList'.
- Some other websites switched to DynamicPageList2 - a version which is commonly considered to be obsolete by now. They may want to change to DPL as it is 95% downward compatible with DPL2.
- Quite a lot of websites use DPL now, i.e. the extension distributed on this website. They call it DPL or DynamicPageList. It uses the tag <dpl> and in addition offers the parser function {{#dpl: ....}}. The source is available here under Download.
There is an opinion which says that running DPL on a major public website would introduce the risk that people write queries which consume a lot of resources. And apart from there is the problem of incompatibilities between 'Intersection' and DPL.
It is time to put an end to this mess.
- A large effort was recently put into DPL to make it functionally 100% downward compatible with 'Intersection'. Missing commands were added and the semantics of some existing commands were slightly altered. For details read the chapter on DPL:Manual - Compatibility.
- A concept of functional restrictions was introduced which allows it to configure DPL with different levels of functionality. The lowest level corresponds exactly to 'Intersection' as of today.
- An advanced caching concept was introduced which makes it possible to save the result of DPL queries independent from the rest of a page. This means that this DPL cache even survives edit actions of the page containing the DPL invocation - as long as the DPL statement itself is not changed.
So, in near future there will only be one extension named DynamicPageList(DPL) which unites all previous branches.
° In the standard configuration DPL registers the <DynamicPageList> tag. This is needed to be downward compatible with extension 'Intersection'.
In the transition phase you may want to install DPL in PARALLEL to 'Intersection' for testing. DPL offers a second entry point for that purpose. Instead of require_once("DynamicPageList.php") you have to use require_once("DPLMigration.php"). DPL will then ONLY register a tag called <Intersection>
In this constellation you can change some of your existing calls of 'Intersection' (which use the <DynamicPageList> tag) to the <Intersection> tag. Once you are convinced that this produces identical results and works with equal efficiency you can change to require_once("DynamicPageList.php"). Don't forget to change the statements back to the <DynamicPageList> tag!. Of course you must also remove the require_once() for the Intersection extension. °°° The code of this extenstion uses some MySQL-specific functions which don't exist in PostgreSQL. In order to avoid patching each new version of DyanmicPageList, I suggest to run the following script on your postgres Database (from the postgres account). This simply emulates the MySQL functions.
create schema mysql; grant usage on schema mysql to public; alter user wikiuser set search_path to mediawiki, public, mysql; create or replace function mysql.concat(text, text) returns text as $function$ begin return $1 || $2; end; $function$ language plpgsql immutable strict; create or replace function mysql.if(boolean, text, text) returns text as $function$ begin if $1 then return $2; else return $3; end if; end; $function$ language plpgsql immutable strict; create or replace function mysql.ifnull(text, text) returns text as $function$ select coalesce($1, $2) as result $function$ language 'sql';
°
{{#dplmatrix: name | yes | no | mode | '''indented_list''' }}
°
{{#dplnum:text}}
°
ordermethod | Determines what criterium (resp. criteria) is (resp. are) used to order the list. |
Syntax:
ordermethod=method1,method2,...
means ordered by method1 first, then by method2, etc. (like the ORDER BY clause in SQL)
methodN can be one of the following single tokens:
- categoryadd
- outputs list based on most recent addition to the first category (requires to include one category and one only using 'category' parameter)
- counter
- outputs list based on the number of times the page has been viewed (by ~popularity)
- size
- outputs list based on the size of the article (bytes of wiki text)
- firstedit
- outputs list based on first edit to the pages (creation)
- lastedit
- outputs list based on most recent edit to the pages
- pagetouched
- outputs list based on 'page_touched' timestamp. Read comment on
page_touched
field in Page_table to see the difference from most recent edit by an author. - pagesel
- outputs list based on the names of the reference pages which are used in the selection of a linksfrom or linksto statement. pagesel only makes sense if there is more than one page mentioned in the linksfrom or linksto condition.
- title
- outputs list sorted by article (prefix +) title
- titlewithoutnamespace
- outputs list sorted by the article name regardless of namespace — (default)
methodN can also be one of the following token combinations (see also headingmode option):
- category,firstedit
- outputs list sorted by category, then by first edit
- category,lastedit
- outputs list sorted by category, then by last edit within a category
- category,pagetouched
- outputs list sorted by category, then by pagetouched
- category,sortkey
- sortkey
- outputs list sorted by title and sortkey, requires at least one category statement
- user,firstedit
- outputs list sorted by user, then by firstedit by the user
- user,lastedit
- outputs list sorted by user, then by lastedit by the user
- none
- do not apply any ordering (except ordering by timestamp if you requested a list of revisions); this method must be used when you specify openreferences=yes.
Note: For downward compatibility reasons DPL will use 'addfirstcategory' as its default order method if called via the <dynamicPageList>
Example:
<DPL> category=Africa ordermethod=lastedit </DPL>
This list will output pages that have [[Category:Africa]] showing most recently edited articles at the top. °
{{#dplchapter: text | heading | limit | page | linktext }}
°|°}} {{#arraysort:x|random}} {{#arrayindex:x|0}}
3
- Cameroon
- Align=right
475,442
- Align=right
923,768
- Align=right
637,657
- Align=right
2,505,813
2
Country | Official Name | Capital | Dial Code |
---|---|---|---|
DPL Example 007 main page 1 (%COUNT%) | Template:Country dpl.default | ||
Nigunda (%COUNT%) | Republic of Nigunda | Bamitogoo | 237 |
Nigunda Test (%COUNT%) | Republic of Nigunda Test | Bamitogoo Test | 237 |
Somango (%COUNT%) | Somango Island | Aaaabququque | 224 |
Number of data = 1
No | Name | Languages | Government | Area | Population | GDP | Independence Day |
---|---|---|---|---|---|---|---|
1 | Republic of Cameroon | French,English | Republic | 183,568 sq mi | 17,795,000 | $43.196 billion | 01/10/1961 |
- Template:Main
- Template:Country
- Template:Country dpl
- Template:(!
- Template:!)
- Template:!
- Template:!-
- Template:Sortable Tables
- Template:Infobox Country or territory dpl
- Template:Infobox Country or territory dpl2
- Template:See also
- Template:Linkedimage
- Template:CurrentUsers
- Template:Infobox Country or territory
- Template:Articles
- Template:Person.ref.Person
- Template:Friend
- Template:DPL parameter
- Template:DPL parameter.overview
- Template:Type Manual.overview
- Template:Type Manual
- Template:Schnittstellen Übersicht Mini
- Template:Schnittstellen Übersicht Mini dpl
- Template:LoadTestChapter
- Template:LoadTest
- Template:Way up
- Template:Is to come
- Template:Todo
- Template:High
- Template:Todo.dpl
- Template:Low
- Template:None
- Template:Todo.pri
- Template:CalendarSingle
- Template:Calendar/MonthStartThu
- Template:Calendar anchor
- Template:Calendar link
- Template:Calendar/MonthStartMon
- Template:Calendar/MonthStartTue
- Template:Calendar/MonthStartWed
- Template:Calendar/MonthStartFri
- Template:Calendar/MonthStartSat
- Template:Calendar/MonthStartSun
- Template:DPL Count
- Template:Event
- Template:Calendar month
- Template:Event template
- Template:African Country
- Template:Painter
- Template:Is friend of
- Template:Wgraph edgetype
- Template:Wgraph node
- Template:Is friend of.dpl
- Template:Wgraph edgetype.dpl
- Template:Wgraph node.dpl
- Template:Wgraph
- Template:Wgraph node.dpl.default
- Template:Is friend of.dpl.default
- Template:Catlist
- Template:Catlist1
- Template:Export.dpl.default
- Template:Category with count
- Template:Todo2
- Template:Nosigr
- Template:For page size test page 2
- Template:Page size test page 1
- Template:Catgraph
- Template:Wgraph defaults
- Template:Links 1
- Template:Links 2
- Template:Links 2.1
- Template:LinksToWithRedirect
- Template:Catlist/zh
- Template:Population Checker
- Template:Population Check
- Template:Population
- Template:Population.dpl
- Template:Country Population
- Template:Test Country Population
- Template:Population.dpl1
- Template:Population Check1
- Template:Population Checker1
- Template:Some Template
- Template:Some Template.dpl
- Template:Some Template.dpl2
- Template:CatTree
- Template:CatTreeSub
- Template:Step.dpl
- Template:Catlist zh
- Template:LinksTo
- Template:Create Event
- Template:Nachkommen
- Template:Paar
- Template:Issue
- Template:Wgraph Command
- Template:Cmdref headline
- Template:Cmdref menu
- Template:Wgraph Command.default
- Template:Alias Wgraph
- Template:See Wgraph
- Template:TempTree
- Template:Symbols
- Template:!!
- Template:CategoryGallery
- Template:Catlist/zh 2
- Template:Listing Redirects and Location Sub
- Template:DT Article Edit (Form)
- Template:DT Article Header
- Template:DT Article Help (Form)
- Template:DT Article Intro (Form)
- Template:DT Article Wiki (Form)
- Template:DT Article XML (Form)
- Template:DT Article copy
- Template:DT Article copy (Intro)
- Template:DT Article show Refs
- Template:DT Articles list Wiki
- Template:DT Articles list Wiki (Form)
- Template:DT Articles list XML
- Template:DT Articles view (Form)
- Template:DT Category
- Template:DT Form Field
- Template:DT Form Field Ref
- Template:DT Article Edit (Intro)
- Template:DT Form Field Text
- Template:DT Form Header
- Template:DT Scripts index
- Template:DT Type (Form)
- Template:DT Article
- Template:DT Type create
- Template:DocTypes
- Template:DT Article Edit (Intro).de
- Template:DT Article Edit (Syntax)
- Template:DT Article Edit (Syntax).de
- Template:DT Article Help (Intro)
- Template:DT Article Help (Intro).de
- Template:DT Article Intro (Intro)
- Template:DT Article Intro (Intro).de
- Template:DT Article Wiki (Intro)
- Template:DT Article Wiki (Intro).de
- Template:DT Article XML (Intro)
- Template:DT Article XML (Intro).de
- Template:DT Article copy (Intro).de
- Template:DT Articles list HTML
- Template:DT Articles list HTML (Form)
- Template:DT Articles list Wiki export.default
- Template:DT Articles view (Intro)
- Template:DT Articles view (Intro).de
- Template:DT Form Field Link
- Template:DT Form Field Newline
- Template:DT Language
- Template:DT Link
- Template:DT Meta
- Template:DT Ref
- Template:DT Ref.report
- Template:DT Report create
- Template:DT Report create (Form)
- Template:DT Report create (Intro)
- Template:DT Report create (Intro).de
- Template:DT Type create (Form)
- Template:DT Type create (Intro)
- Template:DT Type create (Intro).de
- Template:DT XML Field Text
- Template:Location
- Template:Location.edit
- Template:Location.help
- Template:Location.intro
- Template:Location.report.barchart inhabitants
- Template:Location.report.geoplot inhabitants
- Template:Location.text
- Template:Location.view
- Template:Location.xml
- Template:Location.report.piechart inhabitants
- Template:Trip.edit
- Template:Trip
- Template:Trip.view
- Template:Trip.ref.Location
- Template:Trip.text
- Template:Trip.help
- Template:Trip.intro
- Template:Location.report.inhabitants.data
- Template:DT Form Header.meta
- Template:DT Ref.report.default
- Template:Person.ref.Location
- Template:Person.edit
- Template:Person
- Template:Person.view
- Template:Trip.ref.Person
- Template:Person.help
- Template:Person.intro
- Template:Person.text
- Template:DT Articles list csv
- Template:Person.csv
- Template:DT Article csv (Form)
- Template:Trip.csv
- Template:DT Article csv (Intro)
- Template:DT Article csv (Intro).de
- Template:DT csv
- Template:Location.csv
- Template:Calendar month zh-tw
- Template:CalendarSingle zh-tw
- Template:Calendar navigation
- Template:Calendar link zh-tw
- Template:Create Event zh-tw
- Template:Event template zh-tw
- Template:Event zh-tw
- Template:DPL Calendar code generater zh-tw
- Template:Invalid page
- Template:Type?.intro
- Template:Type?.text
- Template:Test subgoal
- Template:ECP number maker
- Template:ECP Issue
- Template:ECP
- Template:Type Test
- Template:Is a
- Template:Student
- Template:Ask is a
- Template:Type?.help
- Template:Flickr code generater
- Template:Topic group.dpl
- Template:Topic group
- Template:Topic
- Template:PoI
- Template:GoogleMap
- Template:PoI gm
- Template:+
- Template:-
- Template:.cat definition
- Template:.cat make
- Template:.cat show
- Template:.class browse
- Template:.class create
- Template:.class definition
- Template:.class description
- Template:.class inheritance
- Template:.class instances
- Template:.class intro
- Template:.class menu
- Template:.class parents
- Template:.class parents 2
- Template:.class parents 3
- Template:.class parents 4
- Template:.class preload
- Template:.class properties
- Template:.class properties 2
- Template:.class properties 3
- Template:.class properties 4
- Template:.class references
- Template:.class references.ask
- Template:.class summary
- Template:.form field
- Template:.form header
- Template:.instances export wiki
- Template:.instances list html
- Template:.instances list html (form)
- Template:.model class
- Template:.model extends
- Template:.model graph
- Template:.model meta graph
- Template:.model meta show
- Template:.model prop
- Template:.model show
- Template:.obj create
- Template:.obj create with form
- Template:.obj data template make
- Template:.obj get
- Template:.obj getMy
- Template:.obj getMyText
- Template:.obj getText
- Template:.obj intro
- Template:.obj intro Location
- Template:.obj intro Musical Instrument
- Template:.obj intro Student
- Template:.obj intro Subject
- Template:.obj intro ask
- Template:.obj intro make
- Template:.obj intro top
- Template:.obj is a
- Template:.obj is instance of
- Template:.obj is referenced by
- Template:.obj is referenced by.ask
- Template:.obj preload Location
- Template:.obj preload Musical Instrument
- Template:.obj preload Student
- Template:.obj preload Subject
- Template:.obj preload make
- Template:.obj set
- Template:.prop assigned by
- Template:.prop built-in
- Template:.prop create
- Template:.prop definition
- Template:.prop derived from
- Template:.prop describes
- Template:.prop intro
- Template:.prop mandatory
- Template:.prop preload
- Template:.prop refers to
- Template:.prop reverse
- Template:.prop unique
- Template:.report
- Template:.type built-in
- Template:Belongs to
- Template:Coordinates
- Template:Group
- Template:Is part of
- Template:Placement
- Template:Born in
- Template:Has team mate
- Template:Plays
- Template:Studies
- Template:Studies in
- Template:Invented in
- Template:Born at
- Template:Musical Instrument
- Template:.prop scope
- Template:Print as one piece
- Template:Has document part
- Template:Part of master document
- Template:Continue with part
- Template:Print whole text
- Template:.obj intro Freshman
- Template:.obj intro Game
- Template:Game
- Template:Subject
- Template:.obj intro Person
- Template:Freshman
- Template:.obj preload Game
- Template:.obj preload Person
- Template:.obj preload Freshman
- Template:Game.list
- Template:Freshman.list
- Template:Person.list
- Template:Subject.list
- Template:Location.list
- Template:Musical Instrument.list
- Template:.obj preload
- Template:.list
- Template:Student.list
- Template:ECP-00055
- Template:DPL Page Name S/N Maker
- Template:Test
- Template:Abc/x123
- Template:Tl
- Template:List articles on people by last name
- Template:My special article lister
- Template:Datetest.dpl
- Template:Datetest
- Template:Amp
- Template:Test get chapter
- Template:DPL Cache Warning
- Template:Bulk Update
- Template:Teaser
- Template:Example
- Template:Country.phantom-004
- Template:DPL Example 007 sub
- Template:DPL Example 007 sub 2
- Template:DPL Example 009 sub
- Template:DPL Example 010 tpl
- Template:DPL Example 010 sub
- Template:DPL Example 102 piechart
- Template:DPL Example 103 barchart
- Template:DPL Page Name S/N Maker test
- Template:DPLSNMakerSF
- Template:Test Amp3/Template
- Template:Test Amp3/Template2
- Template:UsageCount
- Template:Index
- Template:Index.dpl1
- Template:Index.dpl2
- Template:DPL Example 018 sub
- Template:Comma
- Template:Extension DPL
- Template:Extension DPL scroll
- Template:Extension DPL cache
- Template:DPL stable version
- Template:Country.listByCapital
- Template:ExportTransitive
- Template:ExportTransitive.img
- Template:ExportTransitive.sub
- Template:Dpl.pfunc.default
- Template:Dpl.pfunc
- Template:.+.pfunc.default
- Template:.+.pfunc
- Template:Extension DPL continue
- Template:Dpl.tag.default
- Template:Dpl.tag
- Template:Set Template Parameter
- Template:DummyTemplate
- Template:TOCright
- Template:UsesTest
- Template:ShortenString
- Template:Short
- Template:ShortURL
- Template:Templink
- Template:ShortURL/Examples
- Template:ShortURL/Examples/List
- Template:ShortLink/Examples
- Template:ShortLink
- Template:ShortLink/Examples/List
- Template:Infobox Country or territory.dpl
- Template:Template.edit
- Template:Infobox Country or territory.edit
- Template:Car
- Template:.obj intro car
- Template:.obj preload car
- Template:Vehicle
- Template:.obj intro vehicle
- Template:.obj preload vehicle
- Template:Vehicle.list
- Template:Car.list
- Template:Test2
- Template:Googlemap.*.dpl
- Template:Tmp2
- Template:Goglemap.*.dpl.default
- Template:Goglemap.*.dpl
- Template:RP.dpl.default
- Template:DPL/Navi/3
- Template:DPL/ImgUsed/ResNum
- Template:DPL/ImgUsed/LinkedFrom
- Template:Siblings
- Template:ActivitySummary
- Template:Activity Description
- Template:Sandbox
- Template:Sandbox2
- Template:Some Template.dpl3
- Template:Redirs
- Template:Translation
- Template:Translation.table
- Template:Magazine
- Template:Book
- Template:Publication
- Template:Publication.default
- Template:Magazine.published.default
- Template:Book.published.default
- Template:Book.published
- Template:Magazine.published
- Template:About
- Template:Basepage subpage
- Template:Category handler
- Template:Category handler/blacklist
- Template:Category handler/numbered
- Template:Citation/core
- Template:Citation/identifier
- Template:Citation/make link
- Template:Citation needed
- Template:Cite book
- Template:Cite encyclopedia
- Template:Cite web
- Template:Column-count
- Template:Commons
- Template:EB1911
- Template:Fix
- Template:Fix/category
- Template:Greenwood&Earnshaw2nd
- Template:Harvard citation/core
- Template:Hatnote
- Template:Hide in print
- Template:If pagename
- Template:Ifsubst
- Template:Infobox
- Template:Infobox/row
- Template:Infobox mineral
- Template:Jewellery
- Template:Namespace detect
- Template:Navbox
- Template:Only in print
- Template:Other uses
- Template:Px
- Template:Reflist
- Template:Sfn
- Template:Side box
- Template:Silica minerals
- Template:Sister
- Template:Transclude
- Template:=
- Template:Audio
- Template:Cite journal
- Template:Cite news
- Template:Column-width
- Template:Convert
- Template:Convert/LoffAoffDbSoff
- Template:Convert/LoffAonSoff
- Template:Convert/kg
- Template:Convert/lb
- Template:Convert/numdisp
- Template:Convert/outsep
- Template:Convert/test/A
- Template:DMCA
- Template:Dated maintenance category
- Template:Doi
- Template:FULLROOTPAGENAME
- Template:Link GA
- Template:Ns has subpages
- Template:OEtymD
- Template:Redirect
- Template:Str left
- Template:Use dmy dates
- Template:Wikisource
- Template:Commons category
- Template:Overline
%TOTALPAGES%
{{#dpl: category=African_Union_member_states¦Cities|resultsheader=%PAGES%|noresultsheader=none|mode=userformat
9
{{#dpl: category=African_Union_member_states¦Cities|resultsheader=%TOTALPAGES%|noresultsheader=none|mode=userformat
9
1 3.2.1
good morning!