FANDOM


This Forum has been archived

Visit the new Forums
Forums: Index Support Requests Question about formatting
FANDOM's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.

50px-Replacement filing cabinet.svg

Note: This topic has been unedited for 2802 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.


I have a question about formatting. How do I use the "if" thing, so not every article will display weight, WeX, and Effects?

I'm basically trying to do it here so weight, WeX, and effects are optional for being filled in. --Thenewguy34(Other) 19:13, June 23, 2012 (UTC)

The syntax for an #if statement is:
{{#if: string | value if string is not empty | value if it is empty }}
So what you would do here is, say you were doing the weight column:
{{#if:{{{weight|}}}|!width="30"{{!}}[[Weight (weapon stat)|Wt]]|}}
The string for when it is empty is optional. Anyway, that would make it so the weight header cell won't appear unless the weight parameter is defined when using the template. You will have to do the same for the respective cell below it.
{{#if:{{{weight|}}}|{{!}}<!--Column-->g|}}
I use {{!}} there instead of | because that would confuse the if statement into thinking I've already defined the result when not empty and I'm now defining the result when empty. Wikis get a ! template when they are created. All they are is a pipe character ( | ), but they can be substituted with the template so that you can use pipes when using, because normally a pipe is interpreted as the start of a new parameter.
Anyways, you'll just have to repeat that for everything you want to do. Make sure you change the parameter ({{{weight|}}} up there) for each column you do, and make sure what you choose is what you will actually use when using the template. — Matthew2602 (talk) 22:10, June 23, 2012 (UTC)

I put a question in the coding; can you please answer it? --Thenewguy34(Other) 23:11, June 23, 2012 (UTC)


Never mind, this is getting way too complicated.

--Thenewguy34(Other) 23:24, June 23, 2012 (UTC)

Here, just use this.

{| border="1" cellpadding="2" bgcolor="#CCCCCC"
!width="30"|[[Weapon Rank|Rank]]
!width="30"|[[Usage|Uses]]
!width="30"|[[Might|Mt]]
!width="30"|[[Hit%|Hit]]
!width="30"|[[Range|Rng]]
!width="30"|[[Cost|Worth]]
!width="30"|[[Critical Rate|Crt]]
{{#if:{{{weight|}}}|!width="30"{{!}}[[Weight (weapon stat)|Wt]]|}}
{{#if:{{{wex|}}}|!width="30"{{!}}[[Weapon Experience|WEx]]|}}
{{#if:{{{effects|}}}|!width="400"{{!}}[[Weapon effectiveness|Effects]]|}}
|-
|<!--Column-->g
|<!--Column-->g
|<!--Column-->g
|<!--Column-->g
|<!--Column-->g
|<!--Column-->g
|<!--Column-->g
{{#if:{{{weight|}}}|{{!}}{{{weight}}}|}}
{{#if:{{{wex|}}}|{{!}}{{{wex}}}|}}
{{#if:{{{effects|}}}|{{!}}{{{effects}}}|}}
|}
Matthew2602 (talk) 23:33, June 23, 2012 (UTC)
Alright, I will try it and see if it works. --Thenewguy34(Other) 09:48, June 24, 2012 (UTC)
I tried it, it's not working as a template. --Thenewguy34(Other) 09:59, June 24, 2012 (UTC)
Make sure you use |weight=, |wex=, and |effects=. You can change those by changing the word in {{{weight|}}} and {{{weight}}}, {{{wex|}}} and {{{wex}}}, or {{{effects|}}} and {{{effects}}} to a different word. — Matthew2602 (talk) 10:18, June 24, 2012 (UTC)
Community content is available under CC-BY-SA unless otherwise noted.