Difference between revisions of "DPL Example 014"

From FollowTheScore
Jump to: navigation, search
Line 9: Line 9:
 
  |titlematch=B%
 
  |titlematch=B%
 
  |count=10
 
  |count=10
  |format=,%TITLE%,§,
+
  |format=,%TITLE%,°,
}}|§}}|/§$/|}}
+
}}|/°$/|}}|°}}
{{#arrayprint:x|<br/>}}
+
{{#arrayprint:x|---}}
 
</nowiki></pre>
 
</nowiki></pre>
  
 
-----------------------------------
 
-----------------------------------
 
DPL produces the following wikitext as output (which is fed into #arraydefine ..):
 
DPL produces the following wikitext as output (which is fed into #arraydefine ..):
{{#replace:
 
 
{{#dpl:
 
{{#dpl:
 
  |debug=5
 
  |debug=5
 
  |titlematch=B%
 
  |titlematch=B%
 
  |count=10
 
  |count=10
  |format=,%TITLE%,§,
+
  |format=,%TITLE%,°,
}}|/§$/|}}
+
}}
  
 
Note that the array definition contains a final separator symbol which creates an empty array element at the end of the array.
 
Note that the array definition contains a final separator symbol which creates an empty array element at the end of the array.
Line 31: Line 30:
 
So the following output is produced:
 
So the following output is produced:
  
{{#arraydefine:x|
+
{{#arraydefine:x|{{#replace:
 
{{#dpl:
 
{{#dpl:
 
  |titlematch=B%
 
  |titlematch=B%
 
  |count=10
 
  |count=10
  |format=,%TITLE%,§,
+
  |format=,%TITLE%,°,
}}|§}}
+
}}|/°$/|}}|°}}
{{#arrayprint:x|<br/>}}
+
{{#arrayprint:x|---}}

Revision as of 14:09, 10 May 2009

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|---}}

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

{{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|{{#replace: 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|---}}