DPL Example 014

From FollowTheScore
Revision as of 12:59, 10 May 2009 by Gero (talk | contribs)
Jump to: navigation, search

We load the result of a DPL query into an array and print that array using a different separator. The trick is to use a special separator in the format statement of your DPL query (in this example we use the paragraph symbol).

See [1] to see what you can do with the ArrayExternsion ...

{{#arraydefine:x|{{#replace:
{{#dpl:
 |titlematch=B%
 |count=10
 |format=,%TITLE%,§,
}}|§}}|/§$/|}}
{{#arrayprint:x|<br/>}}

DPL produces the following wikitext as output (which is fed into #arraydefine ..): {{#replace:

{{Extension DPL}}Bruxelles city§Bug Apo§Boolean§Bug Apo 3§Bug'Apo 4§Berlin§Bob Jones Out Sick§Bug SQL 1064§Berliner Mauer§Berlin Wall§
|/§$/|}}

Note that the array definition contains a final separator symbol which creates an empty array element at the end of the array. We can throw that element away using #arrayslice or we delete the final separation character using #replace.



So the following output is produced:

{{#arraydefine:x| Bruxelles city§Bug Apo§Boolean§Bug Apo 3§Bug'Apo 4§Berlin§Bob Jones Out Sick§Bug SQL 1064§Berliner Mauer§Berlin Wall§|§}}

{{#arrayprint:x|
}}