How to set up Mediawiki infoboxes?
May 23, 2008 5:11 AM   Subscribe

Mediawiki infoboxes. I'd like to use a Wikipedia-style infobox in my own personal Mediawiki. Help? Please?

I must be missing something. I have an installation of Mediawiki on my server that I would like to use for cataloging video games. I like how the better video game entries are set up on Wikipedia (example), especially the infoboxes. How can I set up similar infoboxes on my wiki? I realize it has to do with templates, but I can't find a clear "dummies" step-by-step on on how to do it. I looked hard. I promise. BONUS: I like this tool. How can I set up my wiki so the tool will also work with my infoboxes? Thanks!
posted by Otis to Computers & Internet (2 answers total) 1 user marked this as a favorite
Best answer: It's somewhat tricky, as I remember, because you need to be able to use conditional statements in your templates, which aren't, as such, built into MediaWiki (or at least weren't when I did this.)

Right, so then you'll need a couple templates to handle those conditionals:

<div class="empty_line"><p><br /></p></div>
Then basically what you do in your template is (I think...):

{{#if: {{{VariableName|}}} | VariableName={{{VariableName}}} | VariableName not assigned. }}
And then invoke it on your page like:
So for example, take a look at one of the pages on my crappy little wiki, say @-party. The infobox is on the right. Basically you invoke it on each page through a template, in this case {{Jargon}}:
{{Jargon|Term=@-party|Pronunciation=/at180;par`tee/|Usage=[[Grammar:Noun|n.]]|Etymology=[[Etymology:Email|Email]]|Derivation=From the @-sign in an Internet address|Alternate=`@-sign party' /at180;si:n par`tee/|Also=[[boink]]}}
Then here's the relevant portion of the {{Jargon}} template:
{| style="border:solid #aaa 1px; margin:12px; font-size:120%; background:#ffffcc; width:250px; padding:1em; text-align:left; float:right; clear:right;"
|<div style="border:0;margin:0;padding-bottom:12px;">{{ #if: {{{Term|}}} | <span style="font-size:150%; font-weight:bold;">'''{{{Term}}}'''</span> | There must be a term. }} {{ #if: {{{Modifier|}}} | <span style="font-size:120%; font-weight:normal;"> - {{{Modifier}}}</span> | }}</div>
|<div style="padding-left:30px; line-height:100%;">{{ #if: {{{Pronunciation|}}} |{{{Pronunciation}}}|}}{{ #if: {{{Pronunciation-2|}}} |{{{Pronunciation-2}}}<br />|}}{{ #if: {{{Pronunciation-3|}}} |{{{Pronunciation-3}}}<br />|}}{{ #if: {{{Usage|}}} | Usage: {{{Usage}}}<br />|}}{{ #if: {{{Etymology|}}} |Etymology: {{{Etymology}}}<br />|}}{{ #if: {{{Derivation|}}} |Derivation: {{{Derivation}}}<br />|}}{{ #if: {{{Derivation-2|}}} |Alternate: {{{Derivation-2}}}<br />|}}{{ #if: {{{Derivation-3|}}} |Alternate: {{{Derivation-3}}}<br />|}}{{ #if: {{{Synonyms|}}} |''Synonyms:'' {{{Synonyms}}}<br />|}}{{ #if: {{{Antonyms|}}} |''Antonyms:'' {{{Antonyms}}}<br />|}}{{ #if: {{{Also|}}} |''See Also:'' {{{Also}}}<br />|}}</div>
PITA? Kinda. But it works.
posted by ChasFile at 6:34 AM on May 23, 2008

Response by poster: Thanks for the answer...still trying to work on this. Also found some helpful info here.
posted by Otis at 2:02 PM on May 26, 2008

« Older Best movies of 2008 so far   |   I bet you I was a liberal arts major Newer »
This thread is closed to new comments.