Difference between revisions of "Sandbox"
Pathoschild (talk | contribs) (+ {{sandbox}}) |
|||
Line 1: | Line 1: | ||
− | feel free to play around | + | feel free to play around; see also [[Template:Sandbox]]. |
== Playground == | == Playground == |
Revision as of 07:51, 28 March 2010
feel free to play around; see also Template:Sandbox.
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|
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 general approach to output formatting is two-fold:
- There are a couple of simple predefined output formats which generate lists of articles
- You will understand their meaning directly from reading
- There is a mode called "userformat" which puts complete control into your hands
- This is somewhat complicated.
While the standard output formats are meant to be used for fast generation of simple page lists, the userformat approach aims at transcluding contents from other pages and requires some effort to understand. There is a system of three tags which are used to enclose (a) the whole output, (b) each item, (c) each transcluded section of an item. A fourth tag is used to separate values between items of one section which occur more than once.
We assume that we have two documents which use templates x and y with varying arguments; while x is being used once within each document, y is used several times. In very short notation the structure might look as follows:
A: x(a) y(3) y(5) B: x(b) y(4) y(1) y(2)
The following DPL parameters are used to define a set of tags which are used to construct the output:
- listseparators = liststart,itemstart,itemend,listend
- secseparators = sec-1-start,sec-1-end,sec-2-start,sec-2-end, .. , ..
- multisecseparators = multi-sep
The arguments of the above statements can contain references to %VARIABLES%. So sec-1-start might contain a reference like %PAGE% to output the page name. See format for more details on variable substitution.
Now think of the following page inclusion statement:
includepage={x}.dpl,{y}.dpl
The output will then look like this:
liststart itemstart sec-1-start x.dpl(a) sec-1-end sec-2-start y.dpl(3) multi-sep y.dpl(5) sec-2-end itemend itemstart sec-1-start x.dpl(b) sec-1-end sec-2-start y.dpl(4) multi-sep y.dpl(1) multi-sep y.dpl(2) sec-2-end itemend listend
Assuming that the tags (liststart, itemstart, etc.) contain wiki syntax for table definitions and multi-sep defines a horizontal line, the output might look like this:
+------+---------------------+ | | | y.dpl(3) | | A | x.dpl(a) | ---- | | | | y.dpl(5) | +------+----------+----------+ | | | y.dpl(4) | | | | ---- | | B | x.dpl(b) | y.dpl(1) | | | | ---- | | | | y.dpl(2) | +------+----------+----------+
In some situations, however, you may want to create an output table where each of the calls of template y is used to create a separate output row. Using a sortable table you could then easily rearrange the output.
+------+---------------------+ +------+---------------------+ | A | x.dpl(a) | y.dpl(1) | | B | x.dpl(b) | y.dpl(1) | +------+---------------------+ +------+---------------------+ | A | x.dpl(a) | y.dpl(2) | | B | x.dpl(b) | y.dpl(2) | +------+---------------------+ +------+---------------------+ | B | x.dpl(b) | y.dpl(3) | | A | x.dpl(a) | y.dpl(3) | +------+---------------------+ +------+---------------------+ | B | x.dpl(b) | y.dpl(4) | | A | x.dpl(a) | y.dpl(4) | +------+---------------------+ +------+---------------------+ | B | x.dpl(b) | y.dpl(5 | | B | x.dpl(b) | y.dpl(5) | +------+---------------------+ +------+---------------------+
There is a special parameter called dominantsection which you can use to mark one section of your includepage statement as "dominant" (in our example: dominatsection=2 as {y}.dpl is the second argument of our includepage statement). You can only have one dominant section in a DPL statement. Marking a section as "dominant" only makes sense if you have multiple calls of the same template (or multiple chapters with the same heading) in your documents. Each piece of content in the dominant section will generate an individual output row with the values of all other columns being repeated.
As all of the above is not very easy to understand there are additional DPL commands (table, tablerow) which make it fairly easy to create tabular output. °°
updaterules | define a set of rules which are executed to perform an update on selected articles (bulk update or template value editing) |
Syntax:
updaterules=
rule;
...
rule;
Where rule is one of the following:
- rules for batch update of articles
replace pattern; by replacement; before pattern; insert text; after pattern; insert text;
- rules for interactive update of articles
template template name; legend legend article name; table table format; editform form parameters; action form action; hidden value; submit submit button; commit commit button; parameter parameter name; value value; format display format; tooltip text; optional value; afterparm parameter name;
- common rules
summary edit summary text; exec value;
The first group of rules is intended for batch updates of articles. A DPL query can select a group of articles and perform updates like inserting a piece of text at a certain position or changing text portions based on regular expressions.
The second group of rules is intended for interactive form-based editing of template values.
The third group of rules is common to both other groups and controls the update process.
The updaterules feature is intended for wiki expert users only. It is recommended that articles usind this statement are 'protected':
°°
{{#dplreplace:text|pattern|replacement}}
°
(1) {{#dplvar:set |name1|value1|name2|value2|..|..}} (2) {{#dplvar:default|name|value}} (3) {{#dplvar: name}}
°
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. °° Download the ZIP archive and extract the DynamicPageList subdirectory to a directory named yourwiki/extensions/DynamicPageList. You may ignore the other extensions but it is recommended to install at least Call and Inputbox as some DPL based applications like the DPL GUI use them. °|°}} {{#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!
{{PAGENAME}} DPL Invoking Example
LOL!!!
the {{PAGENAME}} is Sandbox