• Welcome to NIWA Community Forums.
 

A Few Infobox Questions

Started by dkpat, May 03, 2011, 10:23:51 PM

Previous topic - Next topic

dkpat

Hey everyone, i am starting to push infoboxes at GSU (which, I'm surprised I never did before now, didn't realize they weren't being used I guess) and I have a few snags I would like help with.

First, (and maybe more complicated) Is there a way to have a section heading not display when none of the fields under it are in use? There isn't any particular field that would always be displayed when that section is in use. I'm working on this template: http://goldensunwiki.net/Template:Infobox_item
Let's say the Item didn't boost any Stats, how would I go about having it figure out that, and then not display the Stat Boost section at all?

Secondly, We are likely to start using Infoboxes for our Djinn soon, and I would like to be able to specify what element it is in the infobox, and it pick up colors to use from that. So Let's say The Djinn in question is Mars (Fire) element. I want the infobox colors to change all together to a red based scheme. But more than one color, not just one. I think, something like this is implemented on N Wiki, but I'm not sure. 

Well, that's my two questions, anybody got answers for me?

BrandedOne

As for the first question, this is what I would do:

{{#if: {{{noboost|}}} | |
{{!}}  colspan="2" class="infobox_section" {{!}} Statistic Boosts }}

This way, if you input {{{noboost}}}, nothing will show up, but if you don't, the header will appear like normal.
(Someone please verify this, I'm still new at coding, so this may be incorrect.)


The second question is more complicated, given the coding you've used for your infobox headers so far. First, you'd have to get the colors you want to include, and expand the coding so it looks something like this:

| style="background: #marscolor1; color: #marscolor2; border-color: #marscolor3"

or whatever you want the style to be. (This could include making templates for each color, if you want, but I don't know how to do that) Then, to make it vary depending on the element, you need to put in switch statements. They work like this:

{{#switch: {{{element|}}} | mars = blahblahblah | mercury = blahblahblah | jupiter = blahblahblah | venus = blahblahblah | }}

You'd put this probably inside the style="stuff" section, and then on the page, you input one of the four elements, and the colors should correspond.
(Also needs verification.)


These are the methods I would employ. If you want me to help you work through this, I'd be happy to assist.


dkpat

After I said I think they do something like that on N-wiki, I went hunting, and I was pretty much right. The have templates named "Golden Sun color 1" "Golden Sun color 2" "Golden Sun color 3" etc. for each series, (I would guess it was taco's handywork)  In the css for the colors they just have a variable setup and make the "color 1" part static in the variable. It seems simple enough in theory. So I might look into doing that.

Also, for the other thing, apparently the wiki editors just decided to combine two sections on the template, and went right ahead... soo.. not a problem now I guess.

BrandedOne

Sweet ;D

Let me know if I can be of more help.

tacopill