FANDOM


Forums: Index Help desk Using if then else in a template?


Greetings!

before I embark on a project for my wiki, I want to find out if I can use if/then/else statements someplace.

As an example, let's say I want a dropdown list, and depending on what the person chooses, the next dropdown/selectionlist will change its contents.

Here is the "plain-english code" I have in my head...

(This is only an example...)

if (the viewer = male) {

   show stat adjustment for male

}

elseif (the viewer = female) {

   show adjustment for female

}

else {

   show adjustment for unknown

}

If this is a possibility, than I can start a project.  If not, I'll have to look for an alternative.

I see that UserTags can determine the selected gender and display different things accordingly...could I place a template link in there?

You can use any of the following parameters to design your tags:

Parameter Description Type Default
u The text to display when the [tagged] user has an unknown gender (not set in their options). Text Required
m The text to display when the [tagged] user is male Text If missing, the uvalue will be used instead
f The text to display when the [tagged] user is female Text If missing, the uvalue will be used instead
order Controls the order of tags in the row. Lower numbers are placed at the start and the biggest number at the end. Number 10100
link Allows you to turn the tag into a link to a page either on the Wiki or anywhere on the Internet. It accepts normal wiki links like "Project:Administrators" or full URLs like "http://www.google.com/". If this is not set then the tag will be displayed as plain text instead. Be aware that interwiki links (like "Wikipedia:Computer") will not work, use a full http:// URL instead. Text blank
title Sets the text displayed when the user hovers their mouse over the tag. Text blank

The male/female/unknown variants exist to support languages other than English, like Italian, that have different nouns for males/females. In English, or other languages that don't differentiate on gender, you can only need to use the u (unknown) field

.

I would start with mw:Help:Extension:ParserFunctions —  Roguebfl   talk    contribs    email   18:39, July 24, 2014 (UTC)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.