Examples/Parameter: format (example 4): Difference between revisions

From DynamicPageList3 Manual
Content added Content deleted
imported>FrozenPlum
(Created page with "<noinclude>{{note|Please '''do not edit''' this page unless you're wanting to edit the manual itself, it is an example included in the manual.|error}}</noinclude><!-- This is the example preloaded for testing, press "Show Preview" to see the example working (at the bottom of the page). If you save this page, it saves as a new section at the bottom of your '''User:Username/Sandbox''' --> ==Example== This would list items in the ''File'' namespace, limited to a count of...")
 
imported>FrozenPlum
m (Update to parser function syntax because again, it contains a complication that needs to be well understood in order to be used successfully. The general use and syntax page only describes escaping being necessary for "extensions", it is also required for gallery syntax.)
Line 6: Line 6:
==Example==
==Example==


This would list items in the ''File'' namespace, limited to a count of 3, formatted as a gallery using the <code>''Startall''</code> and <code>''Endall''</code> positions of the {{DPL|format}} syntax to specify gallery start and end. The <code>''Start''</code> position in the syntax specifies the <code>%PAGE%</code> (in this case the file page) followed by a line break <code><nowiki>\n</nowiki></code> to populate the MediaWiki gallery syntax needed. The <code>''Start''</code> and <code>''End''</code> (empty, not required) parts of the syntax are applied to each result in the list, so the file page name is fetched for each image and put on a new line to complete the gallery statement. See [[mw:Help:Images#Gallery syntax|gallery syntax]] on MediaWiki Wiki for more information on gallery syntax.
This would list items in the ''File'' namespace, limited to a count of 3, formatted as a gallery using the <code>''Startall''</code> and <code>''Endall''</code> positions of the {{DPL|format}} syntax to specify gallery start and end. Note that when DPL3 parser function syntax is used to create a gallery, which uses tag syntax, the <code><</code> and <code>></code> characters must be escaped, so each is replaced by <code>«</code> and <code>»</code> respectively. The <code>''Start''</code> position in the syntax specifies the <code>%PAGE%</code> (in this case the file page) followed by a line break <code><nowiki>\n</nowiki></code> to populate the MediaWiki gallery syntax needed. The <code>''Start''</code> and <code>''End''</code> (empty, not required) parts of the syntax are applied to each result in the list, so the file page name is fetched for each image and put on a new line to complete the gallery statement. See [[mw:Help:Images#Gallery syntax|gallery syntax]] on MediaWiki Wiki for more information on gallery syntax.


<pre>
<pre>
<dpl>
{{#dpl:
namespace = File
|namespace = File
count = 3
|count = 3
format = <gallery mode="packed" widths="80px" heights="80px">,%PAGE%\n,,</gallery>
|format = «gallery mode="packed" widths="80px" heights="80px"»,%PAGE%\n,,«/gallery»
}}
</dpl>
</pre>
</pre>


==Result==
==Result==


<dpl>
{{#dpl:
namespace = File
|namespace = File
count = 3
|count = 3
format = <gallery mode="packed" widths="80px" heights="80px">,%PAGE%\n,,</gallery>
|format = «gallery mode="packed" widths="80px" heights="80px"»,%PAGE%\n,,«/gallery»
}}
</dpl>

<noinclude>
<noinclude>
[[Category:Setting the basic output mode]]
[[Category:Setting the basic output mode]]

Revision as of 02:52, 24 April 2022

Please do not edit this page unless you're wanting to edit the manual itself, it is an example included in the manual.

Example

This would list items in the File namespace, limited to a count of 3, formatted as a gallery using the Startall and Endall positions of the format syntax to specify gallery start and end. Note that when DPL3 parser function syntax is used to create a gallery, which uses tag syntax, the < and > characters must be escaped, so each is replaced by « and » respectively. The Start position in the syntax specifies the %PAGE% (in this case the file page) followed by a line break \n to populate the MediaWiki gallery syntax needed. The Start and End (empty, not required) parts of the syntax are applied to each result in the list, so the file page name is fetched for each image and put on a new line to complete the gallery statement. See gallery syntax on MediaWiki Wiki for more information on gallery syntax.

{{#dpl:
|namespace = File
|count	    = 3
|format    = «gallery mode="packed" widths="80px" heights="80px"»,%PAGE%\n,,«/gallery»
}}

Result

{{#dpl: |namespace = File |count = 3 |format = «gallery mode="packed" widths="80px" heights="80px"»,%PAGE%\n,,«/gallery» }}