Jump to content

Extension:VisualData/Additional parser functions

From mediawiki.org

Visualdata button

[edit]

A "VisualData" button is a special OOUI compounded button, that allows to associate a particular schema to it, and then to pass the related schema to a Javacript callback when the button is pressed. This is currently used by Extension:ContactManager in order to activate jobs and looks as follows:

It can be also considered a form that is updated only occasionally that triggers a particular action.


[edit]

Since version 1.0.4b, VisualData includes a "querylink" parser function (with the following aliases: "visualdataquerylink", "vdataquerylink") through which to simply create query links in order to print dynamically content based on the query string in the target page.

The syntax for the "querylink" parser function is the following:

{{#querylink:Target page|Read more|class=my-class|pageid=123}}


The first parameter is the target page, the second parameter is the button label (if not set the title of the target page will be used), the optional "class" parameter sets the class for the link, and additional named parameters will be used to build the query itself.

In the previous example, the pageid is obtained within a template called from any visualdataquery, where the parameters pagetitle and articleid are always available together the other retrieved properties. Therefore the parser function above becomes:

{{#querylink:Target page|Read more|class=my-class|pageid={{{articleid}}} }}


Finally, the target page may contain a parser function like the following

{{#visualdataprint:{{#urlget:pageid}}
|schema=Experience
|?testimony
|format=raw
}}

in order to print dynamically content based on the query string (note that the name itself of the query attribute is arbitrary). Although an implementation is fairly simple, the query attribute is retrieved using Extension:UrlGetParameters and therefore this extension is required.

This tool can be useful when you store complex data in articles with json content model as main slot, and you want to display all or some of these data to visitors through standard wikitext. It can be used in all cases where the "item" page is dynamic and updated often, or has a similar formatting for the same kind of items, like for online catalogues and shops.


QueryUrl

[edit]

Similar to "querylink" but only providing the url


Base64encode

[edit]

Convenience function used in conjunction with the printout modifier "+base64" (used with the form parameter "preload-data", in order to pass complex data to the form, that otherwise will break the wiki markup.


Base64decode

[edit]

As above



See also

[edit]