Extension:PageVariable

The PageVariable extension allows you to set a variable in a wiki page, re-use it in that page and in other pages. It provides 2 parser functions #setv and #getv which set and get variables. For usage see end of this page. I use it as a simple method of re-using small elements of one page in another and particularly for extracting one or two elements from templates. It can handle links but like other parser functions will struggle with wiki syntax tables. This function is similar to the labelled section transclusion function.

It needs a parser hook so that it updates the database table on importing data. Maybe one day I will get round to it.

Provided as is & at own risk under GNU general public licence

1) create a new table in your wiki database (you will have to modify this for your database):

2) Put into /wiki/extensions/PageVariable as PageVariable.php the following:

3) add the following line to your wiki/LocalSettings.php:

4) use the following functions: returns VARIABLEVALUE

or:

returns VARIABLEVALUE The function should return html as generated when the original page was parsed. You can use the function within templates to store parsed template data items for later re-use. It has similarity to the tiddlywiki concept of a slice. I use it a lot to allow in conjunction with semantic mediawiki for multiple layouts depending on context. The rare possibility of a circular reference is prevented using a html comment.