Call extension

From FollowTheScore
Jump to: navigation, search

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.

Apart from the above there is an additional feature which supports to save the raw text of the called template. Via "saveAsPage=..." you can specify the page name which shall be used. The other parameters are used to replace symbols in the called template by their value. If the target page exists it will not be overwritten.


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.

Known Problems

Some users report problems with the Call extension. This is due to hidden parameters which the browser adds to the http request. Such parameters contain session information from cookies and sometimes the Call extension erroneously assumes that one of them should be the name of the wiki page you want to adress.

If you get strange results check with "Debug" and some parameters like this: http://semeb.com/dpldemo/index.php?title=Special:Call/DebuG,a=b,c&d=e&f

This should show something like

 ...
 n:title:Special:Call/DebuG,a=b,c
 n+1:d:e
 n+2:f:
 ...

 par=DebuG,a=b,c
 argTitle=n
 argCount=n+2

 {{DebuG|a=b|c|d=e|f}}

where n is an integer >= 0.