Difference between revisions of "DPL Example 025"

From FollowTheScore
Jump to: navigation, search
(New page: {{subst::DPL Example 001}})
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Example|Create a table of articles based on template parameters}}
+
{{Example|Show a single template parameter value of a specific page}}
 
 
Note that the sequence of the parameters is independant from their occurence within the template call.
 
 
 
You could also use numbered parameters instead of named parameters.
 
 
 
The first column ('Article') refers to the article which called the template is generated automatically.
 
 
 
Sequence is alphabetically. (See [[DPL Example 023]] for different sorting)
 
  
 +
To show the capital of a country called [[Nigunda]] you can use a very simple DPL statement. We assume that the artcile on Nigunda uses a template named [[Template:Country]] which expects a parameter named 'capital'.
 +
The notation is so short that you can even use it as an integral part of your text:
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
The capital of Nigunda is {{#dpl:title=Nigunda|include={Country}:capital}}.
|category=Fictitious country
 
|include={Country}:capital:name
 
|table=,,Capital,Name
 
}}
 
 
</nowiki></pre>
 
</nowiki></pre>
 
+
And you get: The capital of Nigunda is {{#dpl:title=Nigunda|include={Country}:capital}}.
----
 
The above DPL command produces the following output:
 
----
 
 
 
{{#dpl:
 
|category=Fictitious country
 
|include={Country}:capital:name
 
|table=,,Capital,Name
 
}}
 

Latest revision as of 13:05, 23 June 2009

back to list of examples

Show a single template parameter value of a specific page

To show the capital of a country called Nigunda you can use a very simple DPL statement. We assume that the artcile on Nigunda uses a template named Template:Country which expects a parameter named 'capital'. The notation is so short that you can even use it as an integral part of your text:

The capital of Nigunda is {{#dpl:title=Nigunda|include={Country}:capital}}.

And you get: The capital of Nigunda is Bamitogoo.