I am very new to mediawiki and ddeveloping with it.
Goal: to create a leader board page that dynamically populates users and there stats.
Leaderboard
{{UserScore
| Username = Timmy
| Score = 100
| Badges = 5
}}
LeaderBoard is showing data like this:
{{#vardefine: Username|Timmy}} {{#vardefine: Score|100}} {{#vardefine: Badges|5}}
Not sure why or how to display better.
Template:UserScore
<includeonly>{{ #vardefine: Username | {{{Username}}} }}</includeonly>
<includeonly>{{ #vardefine: Score | {{{Score}}} }}</includeonly>
<includeonly>{{ #vardefine: Badges | {{{Badges}}} }}</includeonly>
It looks like you haven't installed the extension Variables.
But you shouldn't have anyway. Variables were meant to reuse the same data within one page; and even that they can no longer do, due to changes in wiki parsing.
To display the data, define Template:UserScore
like this:
{| class="infobox"
! Username || {{{Username|{{PAGENAME}}}}}
|-
! Score || {{{Score|0}}}
|-
! Badges || {{{ Badges|}}}
|}
To query that data from other pages, you might want to install Semantic MediaWiki or Cargo.
if you have installed Semantic MediaWiki, redefine Template:UserScore
like this:
{| class="infobox"
! Username || {{{Username|{{PAGENAME}}}}} {{#set:Username={{{Username|{{PAGENAME}}}}}}}
|-
! Score || {{{Score|0}}} {{#set:Score={{{Score|0}}}}}
|-
! Badges || {{{ Badges|}}} {{#set:Has badge={{{Badges|}}}|+sep=,}}
|}
Create Property:Username
as (some description) {{#set:Has type=Text}}
, Property:Score
as (some description) {{#set:Has type=Number}}
and Property:Has badge
as (some description) {{#set:Has type=Page}}
.
Then you can query, e.g. on the page The Sublime Badge of Everlasting Honour
:
The following people have the badge {{PAGENAME}}:
{{#ask: [[Has badge::{{FULLPAGENAME}}]]
| ?Username
}}
The examples I have given are too primitive for production use, but you can make them more complex afterwards.