Difference between revisions of "Call extension"

From FollowTheScore
Jump to: navigation, search
(New page: The ''Call extension'' provides a special page which can be used to invoke a (template) page with parameter passing. This little extension can be quite useful if you want to call Templates...)
 
Line 13: Line 13:
 
Now let us call the article with 'Hello world' as a parameter. In wikitext we write
 
Now let us call the article with 'Hello world' as a parameter. In wikitext we write
 
<pre>
 
<pre>
  [[Special:Call/:Call,Hello world!| good morning! ]]
+
  [[Special:Call/:Call extension,Hello world!| good morning! ]]
 
</pre>
 
</pre>
Now try [[Special:Call/:Call,Hello world!| good morning! ]] and watch the effect.
+
Now try [[Special:Call/:Call extension,Hello world!| good morning! ]] and watch the effect.
  
 
===Syntax===
 
===Syntax===
Line 25: Line 25:
 
** You may either use '''unnamed parameters''' or '''named parameters''' (like param=value)
 
** You may either use '''unnamed parameters''' or '''named parameters''' (like param=value)
  
For example [[Special:Call/:Call,Hello world,who=to everybody| try this ]] call to our article..
+
For example [[Special:Call/:Call extension,Hello world,who=to everybody| try this ]] call to our article..
 
{|class=wikitable
 
{|class=wikitable
 
!width=200| {{{1|}}} {{{who|}}}
 
!width=200| {{{1|}}} {{{who|}}}
Line 31: Line 31:
 
and you will see that our article understands a second parameter. We used
 
and you will see that our article understands a second parameter. We used
 
<pre>
 
<pre>
   [[Special:Call/:Call,Hello world,who=to everybody| try this ]]
+
   [[Special:Call/:Call extension,Hello world,who=to everybody| try this ]]
 
</pre>
 
</pre>
 
for the above link.
 
for the above link.

Revision as of 20:03, 23 July 2007

The Call extension provides a special page which can be used to invoke a (template) page with parameter passing. This little extension can be quite useful if you want to call Templates (or even normal pages) via normal links.

The idea is quite simple and can be best explained by an example:

This article (named Call) lives in the main namespace. If it is called normally, you will see an empty box in the next line:

The reason is that the line contains a reference to {{{1|}}}. If you followed a normal link to this article, there was no parameter passed, so the box is empty.

Now let us call the article with 'Hello world' as a parameter. In wikitext we write

 [[Special:Call/:Call extension,Hello world!| good morning! ]]

Now try good morning! and watch the effect.

Syntax

  • After Special:Call you write a '/' and then follows the article name.
    • If the article is a template you just write its name
    • If it is in the main namespace you put a ':' before the name
    • You can also specify every other namespace like user: etc.
  • After the article name you have a comma separated list of parameters
    • You may either use unnamed parameters or named parameters (like param=value)

For example try this call to our article..

and you will see that our article understands a second parameter. We used

  [[Special:Call/:Call extension,Hello world,who=to everybody| try this ]]

for the above link.

Typical Application

Let us assume you have a huge graph and want to see only parts / certain aspects of it. With Call you can easily offer a list of links in a normal article which produce different subgraph views. You write a template which contains the Wgraph call and within that template you use a 'region' statement which expects the starting point for the subgraph. Now different calls of this template will lead to different views (you may want to choose between 'state=boxed' or 'state=exclusive') of your graph.

If you combine the Call extension with the Inputbox extension you can even offer a dialog box where the user can enter the node name which shall be taken as a starting point; see Wgraph:Sample Genealogy 8 for an example.