DPL Example 014

From Dpldemo
Revision as of 14:12, 10 May 2009 by Gero (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 °, i.e. the degree symbol).

See [1] to learn 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 ..):

B°Backward compatibility with DynamicPageList2 'suppresserrors' parameter°Baka dancers June 2006.jpg°Bar chart.png°Basepage subpage°Bassoon°Beatz°Beckers°Belgium°Belongs to°

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:


B---Backward compatibility with DynamicPageList2 'suppresserrors' parameter---Baka dancers June 2006.jpg---Bar chart.png---Basepage subpage---Bassoon---Beatz---Beckers---Belgium---Belongs to

Personal tools
Ploticus
Call