Examples/Parameter: execandexit (example 2): Difference between revisions

From DynamicPageList3 Manual
Content added Content deleted
imported>FrozenPlum
(Determine a description that fits this example)
imported>FrozenPlum
m (Move side-by-side for blank producing statement to reduce unintended whitespace)
 
Line 8: Line 8:
Calling the following page with <code>&DPL_cat=Country examples</code> would list countries, omitting the <code>&cat</code> parameter would trigger the error text message (without DPL3 going to the database):
Calling the following page with <code>&DPL_cat=Country examples</code> would list countries, omitting the <code>&cat</code> parameter would trigger the error text message (without DPL3 going to the database):
<pre>
<pre>
{{#dpl:execandexit=geturlargs}}
{{#dpl:execandexit=geturlargs}}{{#dplvar:set|DPL_cat|Category:Dessert examples}}
{{#dplvar:set|DPL_cat|Category:Dessert examples}}
{{#dpl:
{{#dpl:
| execandexit = {{#if:{{#dplvar:DPL_cat}}||please specify a category via &DPL_cat= in the URL!}}
| execandexit = {{#if:{{#dplvar:DPL_cat}}||please specify a category via &DPL_cat= in the URL!}}
Line 20: Line 19:


==Result==
==Result==
{{#dpl:execandexit=geturlargs}}
{{#dpl:execandexit=geturlargs}}{{#dplvar:set|DPL_cat|Category:Dessert examples}}
{{#dplvar:set|DPL_cat|Category:Dessert examples}}
{{#dpl:
{{#dpl:
| execandexit = {{#if:{{#dplvar:DPL_cat}}||please specify a category via &DPL_cat= in the URL!}}
| execandexit = {{#if:{{#dplvar:DPL_cat}}||please specify a category via &DPL_cat= in the URL!}}

Latest revision as of 08:32, 21 April 2023

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

Example

A typical use appears like the following, the execandexit statement transforms URL args to variables, and the {{#dplvar:set}} sets the value of DPL_cat variable to Category:Dessert examples. Note: The double pipe symbols within the #if. Calling the following page with &DPL_cat=Country examples would list countries, omitting the &cat parameter would trigger the error text message (without DPL3 going to the database):

{{#dpl:execandexit=geturlargs}}{{#dplvar:set|DPL_cat|Category:Dessert examples}}
{{#dpl: 
 | execandexit     = {{#if:{{#dplvar:DPL_cat}}||please specify a category via &DPL_cat= in the URL!}}
 | resultsheader   = Pages in <i>{{#dplvar:DPL_cat}}</i>:\n
 | noresultsheader = There are no pages in <i>{{#dplvar:DPL_cat}}</i>.\n
 | count           = 2
 | category        = {{#dplvar:DPL_cat}}
}}

Result

{{#dpl:execandexit=geturlargs}}{{#dplvar:set|DPL_cat|Category:Dessert examples}} {{#dpl:

| execandexit     = 
| resultsheader   = Pages in {{#dplvar:DPL_cat}}:\n
| noresultsheader = There are no pages in {{#dplvar:DPL_cat}}.\n
| count           = 2
| category        = {{#dplvar:DPL_cat}}

}}