1

In a mediawiki page, I would like to have a checkbox that applies to all pages so that

  1. templates on the page can use the value of the checkbox
  2. when the checkbox is changed, the page refreshes.

The checkbox could be used, say to relegate details in the text into footnotes. E.g. an editor could write "Trains from Bristol Parkway {{Details|opened in 1971}} go to London." The user would see "Trains from Bristol Parkway^1 go to London" or "Trains from Bristol Parkway (opened in 1971) go to London" depending on their preference.

The template "Details" would be something like

{{#ifeq:UserPreference|IncludeDetailsInText|({{{1|}}})|<ref>{{{1|}}}</ref>}}

How do you fetch the UserPreference? Should I use a Widget?

1

This worked.

Use https://www.mediawiki.org/wiki/Extension:Widgets to put a checkbox on your page and then use https://www.mediawiki.org/wiki/Extension:UrlGetParameters to read the value the user chooses for the checkbox into a template.

The Widget is Widget:Checkbox

<form action="" method=GET>
<input type="checkbox" name="footnoteintext">Include footnotes in text
<input type="submit" value="Update">
</form>

The template for showing the footnote is Template:FootnoteOptional

<noinclude>
This is the "FootnoteOptional" template.
It should be called in the following format:
<pre>
{{FootnoteOptional
|Note= 
}}
</pre>
Edit the page to see the template text.
</noinclude><includeonly>{{#if:{{#urlget:footnoteintext}}|  ({{{Note|}}}) |{{#tag:ref|{{{Note|}}}}}}}</includeonly>

The text on the page is

Bristol Parkway {{FootnoteOptional|opened in 1971}} ...

{{#widget:checkbox}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.