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 06: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|
follow the link in the headline .. ° 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':
°
{{#dplmatrix: name | yes | no | mode | '''indented_list''' }}
°
{{#dplnum:text}}
°
{{#dplreplace:text|pattern|replacement}}
°
(1) {{#dplvar:set |name1|value1|name2|value2|..|..}} (2) {{#dplvar:default|name|value}} (3) {{#dplvar: name}}
° 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:!
- Template:!!
- Template:!)
- Template:!-
- Template:(!
- Template:+
- Template:-
- Template:.+.pfunc
- Template:.+.pfunc.default
- 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:.list
- 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 Freshman
- Template:.obj intro Game
- Template:.obj intro Location
- Template:.obj intro Musical Instrument
- Template:.obj intro Person
- Template:.obj intro Student
- Template:.obj intro Subject
- Template:.obj intro ask
- Template:.obj intro car
- Template:.obj intro make
- Template:.obj intro top
- Template:.obj intro vehicle
- Template:.obj is a
- Template:.obj is instance of
- Template:.obj is referenced by
- Template:.obj is referenced by.ask
- Template:.obj preload
- Template:.obj preload Freshman
- Template:.obj preload Game
- Template:.obj preload Location
- Template:.obj preload Musical Instrument
- Template:.obj preload Person
- Template:.obj preload Student
- Template:.obj preload Subject
- Template:.obj preload car
- Template:.obj preload make
- Template:.obj preload vehicle
- 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 scope
- Template:.prop unique
- Template:.report
- Template:.type built-in
- Template:=
- Template:Abc/x123
- Template:About
- Template:ActivitySummary
- Template:Activity Description
- Template:African Country
- Template:Alias Wgraph
- Template:Amp
- Template:Articles
- Template:Ask is a
- Template:Audio
- Template:Basepage subpage
- Template:Belongs to
- Template:Book
- Template:Book.published
- Template:Book.published.default
- Template:Born at
- Template:Born in
- Template:Bulk Update
- Template:Calendar/MonthStartFri
- Template:Calendar/MonthStartMon
- Template:Calendar/MonthStartSat
- Template:Calendar/MonthStartSun
- Template:Calendar/MonthStartThu
- Template:Calendar/MonthStartTue
- Template:Calendar/MonthStartWed
- Template:CalendarSingle
- Template:CalendarSingle zh-tw
- Template:Calendar anchor
- Template:Calendar link
- Template:Calendar link zh-tw
- Template:Calendar month
- Template:Calendar month zh-tw
- Template:Calendar navigation
- Template:Car
- Template:Car.list
- Template:CatTree
- Template:CatTreeSub
- Template:CategoryGallery
- Template:Category handler
- Template:Category handler/blacklist
- Template:Category handler/numbered
- Template:Category with count
- Template:Catgraph
- Template:Catlist
- Template:Catlist/zh
- Template:Catlist/zh 2
- Template:Catlist1
- Template:Catlist zh
- Template:Citation/core
- Template:Citation/identifier
- Template:Citation/make link
- Template:Citation needed
- Template:Cite book
- Template:Cite encyclopedia
- Template:Cite journal
- Template:Cite news
- Template:Cite web
- Template:Cmdref headline
- Template:Cmdref menu
- Template:Column-count
- Template:Column-width
- Template:Comma
- Template:Commons
- Template:Commons category
- Template:Continue with part
- 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:Coordinates
- Template:Country
- Template:Country.listByCapital
- Template:Country.phantom-004
- Template:Country Population
- Template:Country dpl
- Template:Create Event
- Template:Create Event zh-tw
- Template:CurrentUsers
- Template:DMCA
- Template:DPL/ImgUsed/LinkedFrom
- Template:DPL/ImgUsed/ResNum
- Template:DPL/Navi/3
- Template:DPLSNMakerSF
- Template:DPL Cache Warning
- Template:DPL Calendar code generater zh-tw
- Template:DPL Count
- Template:DPL Example 007 sub
- Template:DPL Example 007 sub 2
- Template:DPL Example 009 sub
- Template:DPL Example 010 sub
- Template:DPL Example 010 tpl
- Template:DPL Example 018 sub
- Template:DPL Example 102 piechart
- Template:DPL Example 103 barchart
- Template:DPL Page Name S/N Maker
- Template:DPL Page Name S/N Maker test
- Template:DPL parameter
- Template:DPL parameter.overview
- Template:DPL stable version
- Template:DT Article
- Template:DT Article Edit (Form)
- Template:DT Article Edit (Intro)
- Template:DT Article Edit (Intro).de
- Template:DT Article Edit (Syntax)
- Template:DT Article Edit (Syntax).de
- Template:DT Article Header
- Template:DT Article Help (Form)
- Template:DT Article Help (Intro)
- Template:DT Article Help (Intro).de
- Template:DT Article Intro (Form)
- Template:DT Article Intro (Intro)
- Template:DT Article Intro (Intro).de
- Template:DT Article Wiki (Form)
- Template:DT Article Wiki (Intro)
- Template:DT Article Wiki (Intro).de
- Template:DT Article XML (Form)
- Template:DT Article XML (Intro)
- Template:DT Article XML (Intro).de
- Template:DT Article copy
- Template:DT Article copy (Intro)
- Template:DT Article copy (Intro).de
- Template:DT Article csv (Form)
- Template:DT Article csv (Intro)
- Template:DT Article csv (Intro).de
- Template:DT Article show Refs
- Template:DT Articles list HTML
- Template:DT Articles list HTML (Form)
- Template:DT Articles list Wiki
- Template:DT Articles list Wiki (Form)
- Template:DT Articles list Wiki export.default
- Template:DT Articles list XML
- Template:DT Articles list csv
- Template:DT Articles view (Form)
- Template:DT Articles view (Intro)
- Template:DT Articles view (Intro).de
- Template:DT Category
- Template:DT Form Field
- Template:DT Form Field Link
- Template:DT Form Field Newline
- Template:DT Form Field Ref
- Template:DT Form Field Text
- Template:DT Form Header
- Template:DT Form Header.meta
- Template:DT Language
- Template:DT Link
- Template:DT Meta
- Template:DT Ref
- Template:DT Ref.report
- Template:DT Ref.report.default
- Template:DT Report create
- Template:DT Report create (Form)
- Template:DT Report create (Intro)
- Template:DT Report create (Intro).de
- Template:DT Scripts index
- Template:DT Type (Form)
- Template:DT Type create
- Template:DT Type create (Form)
- Template:DT Type create (Intro)
- Template:DT Type create (Intro).de
- Template:DT XML Field Text
- Template:DT csv
- Template:Dated maintenance category
- Template:Datetest
- Template:Datetest.dpl
- Template:DocTypes
- Template:Documentation
- Template:Documentation/docspace
- Template:Documentation/end box
- Template:Documentation/end box2
- Template:Documentation/start box
- Template:Documentation/start box2
- Template:Documentation/template page
- Template:Doi
- Template:Dpl.pfunc
- Template:Dpl.pfunc.default
- Template:Dpl.tag
- Template:Dpl.tag.default
- Template:DummyTemplate
- Template:EB1911
- Template:ECP
- Template:ECP-00055
- Template:ECP Issue
- Template:ECP number maker
- Template:Event
- Template:Event template
- Template:Event template zh-tw
- Template:Event zh-tw
- Template:Example
- Template:Export.dpl.default
- Template:ExportTransitive
- Template:ExportTransitive.img
- Template:ExportTransitive.sub
- Template:Extension DPL
- Template:Extension DPL cache
- Template:Extension DPL continue
- Template:Extension DPL scroll
- Template:FULLROOTPAGENAME
- Template:Fix
- Template:Fix/category
- Template:Flickr code generater
- Template:Fmbox
- Template:For page size test page 2
- Template:Freshman
- Template:Freshman.list
- Template:Friend
- Template:Game
- Template:Game.list
- Template:Goglemap.*.dpl
- Template:Goglemap.*.dpl.default
- Template:GoogleMap
- Template:Googlemap.*.dpl
- Template:Greenwood&Earnshaw2nd
- Template:Group
- Template:Harvard citation/core
- Template:Has document part
- Template:Has team mate
- Template:Hatnote
- Template:Hide in print
- Template:High
- Template:If pagename
- Template:Ifsubst
- Template:Index
- Template:Index.dpl1
- Template:Index.dpl2
- Template:Infobox
- Template:Infobox/row
- Template:Infobox Country or territory
- Template:Infobox Country or territory.dpl
- Template:Infobox Country or territory.edit
- Template:Infobox Country or territory dpl
- Template:Infobox Country or territory dpl2
- Template:Infobox mineral
- Template:Infobox mineral.list 1
- Template:Invalid page
- Template:Invented in
- Template:Is a
- Template:Is friend of
- Template:Is friend of.dpl
- Template:Is friend of.dpl.default
- Template:Is part of
- Template:Is to come
- Template:Issue
- Template:Jewellery
- Template:Link GA
- Template:Linkedimage
- Template:LinksTo
- Template:LinksToWithRedirect
- Template:Links 1
- Template:Links 2
- Template:Links 2.1
- Template:List articles on people by last name
- Template:Listing Redirects and Location Sub
- Template:LoadTest
- Template:LoadTestChapter
- Template:Location
- Template:Location.csv
- Template:Location.edit
- Template:Location.help
- Template:Location.intro
- Template:Location.list
- Template:Location.report.barchart inhabitants
- Template:Location.report.geoplot inhabitants
- Template:Location.report.inhabitants.data
- Template:Location.report.piechart inhabitants
- Template:Location.text
- Template:Location.view
- Template:Location.xml
- Template:Low
- Template:Magazine
- Template:Magazine.published
- Template:Magazine.published.default
- Template:Main
- Template:Musical Instrument
- Template:Musical Instrument.list
- Template:My special article lister
- Template:Nachkommen
- Template:Namespace detect
- Template:Navbox
- Template:None
- Template:Nosigr
- Template:Ns has subpages
- Template:OEtymD
- Template:Only in print
- Template:Other uses
- Template:Overline
- Template:Paar
- Template:Page size test page 1
- Template:Painter
- Template:Part of master document
- Template:Person
- Template:Person.csv
- Template:Person.edit
- Template:Person.help
- Template:Person.intro
- Template:Person.list
- Template:Person.ref.Location
- Template:Person.ref.Person
- Template:Person.text
- Template:Person.view
- Template:Placement
- Template:Plays
- Template:PoI
- Template:PoI gm
- Template:Population
- Template:Population.dpl
- Template:Population.dpl1
- Template:Population Check
- Template:Population Check1
- Template:Population Checker
- Template:Population Checker1
- Template:Pp-template
- Template:Print as one piece
- Template:Print whole text
- Template:Publication
- Template:Publication.default
- Template:Px
- Template:RP.dpl.default
- Template:Redirect
- Template:Redirs
- Template:Reflist
- Template:Sandbox
- Template:Sandbox2
- Template:Schnittstellen Übersicht Mini
- Template:Schnittstellen Übersicht Mini dpl
- Template:See Wgraph
- Template:See also
- Template:Set Template Parameter
- Template:Sfn
- Template:Short
- Template:ShortLink
- Template:ShortLink/Examples
- Template:ShortLink/Examples/List
- Template:ShortURL
- Template:ShortURL/Examples
- Template:ShortURL/Examples/List
- Template:ShortenString
- Template:Siblings
- Template:Side box
- Template:Silica minerals
- Template:Sister
- Template:Slow
- Template:Some Template
- Template:Some Template.dpl
- Template:Some Template.dpl2
- Template:Some Template.dpl3
- Template:Sortable Tables
- Template:Step.dpl
- Template:Str left
- Template:Student
- Template:Student.list
- Template:Studies
- Template:Studies in
- Template:Subject
- Template:Subject.list
- Template:Symbols
- Template:TOCright
- Template:Teaser
- Template:TempTree
- Template:Template.edit
- Template:Template other
- Template:Templink
- Template:Test
- Template:Test2
- Template:Test Amp3/Template
- Template:Test Amp3/Template2
- Template:Test Country Population
- Template:Test get chapter
- Template:Test subgoal
- Template:Tl
- Template:Tmp2
- Template:Todo
- Template:Todo.dpl
- Template:Todo.pri
- Template:Todo2
- Template:Topic
- Template:Topic group
- Template:Topic group.dpl
- Template:Transclude
- Template:Translation
- Template:Translation.table
- Template:Trip
- Template:Trip.csv
- Template:Trip.edit
- Template:Trip.help
- Template:Trip.intro
- Template:Trip.ref.Location
- Template:Trip.ref.Person
- Template:Trip.text
- Template:Trip.view
- Template:Type?.help
- Template:Type?.intro
- Template:Type?.text
- Template:Type Manual
- Template:Type Manual.overview
- Template:Type Test
- Template:UsageCount
- Template:Use dmy dates
- Template:UsesTest
- Template:Vehicle
%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