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

m
Move side-by-side for blank producing statement to reduce unintended whitespace
imported>FrozenPlum
(Make the next execandexit example into a working example that both sets and uses dplvar, so the example makes sense and populates results)
 
imported>FrozenPlum
m (Move side-by-side for blank producing statement to reduce unintended whitespace)
 
(One intermediate revision by the same user not shown)
Line 5:
-->
==Example==
A typical use appears like the following, the <code>execandexit</code> statement transforms URL args to variables, and the <code><nowiki>{{#dplvar:set}}</nowiki></code> sets the value of <code>DPL_cat</code> variable to [[:Category:Dessert examples]]. '''Note:''' The double pipe symbols within the #if.
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>
{{#dpl:execandexit=geturlargs}}{{#dplvar:set|DPL_cat|Category:Dessert examples}}
{{#dplvar:set|DPL_cat|Category:Dessert examples}}
{{#dpl:
| execandexit = {{#if:{{#dplvar:DPL_cat}}||please specify a category via &DPL_cat= in the URL!}}
Line 18 ⟶ 19:
 
==Result==
{{#dpl:execandexit=geturlargs}}{{#dplvar:set|DPL_cat|Category:Dessert examples}}
{{#dplvar:set|DPL_cat|Category:Dessert examples}}
{{#dpl:
| execandexit = {{#if:{{#dplvar:DPL_cat}}||please specify a category via &DPL_cat= in the URL!}}
Anonymous user