We're hoping to switch the site over to HTTPS this weekend. Unfortunately this will mean we can no longer embed content via HTTP. Brickshelf only supports HTTP, so reupload your images on another site like Flickr or Imgur so they don't break!

Template:EraG1

From BIONICLEsector01
Jump to: navigation, search


Documentation

This template produces an indicator in the top right corner of the page to show that the article relates to Generation 1 of BIONICLE. Compare to Template:EraG2.

Basic usage

Place this on all Generation 1 articles except character pages (as outlined in the next section):

{{EraG1}}

Dropdown (only for use on character, faction, or event pages)

On these pages, also indicate the "era" in which the character/faction/event played a major story role. "Eras" mostly correspond to years. However, 2003, 2009, and 2010 all include two eras, as the years were divided into distinct plotlines. This makes a total of thirteen eras. Again, only list the eras in which the subject featured prominently, not just when they made an appearance. For example, Hahli and each of the Toa Nuva would not receive era icons for 2004 or 2005, as they only briefly appeared in the framing devices (prologues, etc.). Also, appearances in guide books or Greg quotes do not warrant era icons. For example, Macku appears in BIONICLE: Metru Nui - City of Legends, but this does not warrant a 2004 era icon.

Use this format instead to indicate the eras, removing the ones that are irrelevant. The era icons are grouped in a dropdown that appears next to the main Generation 1 indicator. See Vakama for an example of the template in action.

{{EraG1|1|2|3a|3b|4|5|6|7|8|9|9T|10a|10b}}

  • This page features content from 2001 Era 1 (2001)
  • This page features content from 2002 Era 2 (2002)
  • This page features content from 2003 Era 3a (2003)
  • This page features content from 2003 Era 3b (2003)
  • This page features content from 2004 Era 4 (2004)
  • This page features content from 2005 Era 5 (2005)
  • This page features content from 2006 Era 6 (2006)
  • This page features content from 2007 Era 7 (2007)
  • This page features content from 2008 Era 8 (2008)
  • This page features content from 2009 Era 9 (2009)
  • This page features content from 2009 Era 9T (2009)
  • This page features content from 2010 Era 10 (2010)
  • This page features content from 2010 Era 10 Serials (2010)

Extra: ifeq logic

Here is an explanation of the ifeqs that determine the dropdown tray's width. (Note that if the dropdown contains seven or fewer items, we let the tray determine its width on its own.)

{{#ifeq: {{{8|+}}}|{{{9|{{{8|-}}}}}}|true|false}}

We want the condition to return a unique output when there are 8 items in the tray. In other words, we want it to tell us when parameter 8 is the last parameter that's defined, in which case parameter 8 is defined and parameter 9 isn't.

  • If parameter 8 is defined and parameter 9 is defined: false
    • Parameter 8 is defined, so {{{8|+}}} evaluates to {{{8}}}. Parameter 9 is defined, so {{{9|{{{8|-}}}}}} evaluates to {{{9}}}. {{{8}}} and {{{9}}} are not equal in practice, as each parameter contains different text since they each represent a different era. Therefore the condition evaluates as false.
  • If 8 is undefined and 9 is undefined: false
    • Parameter 8 is undefined, so {{{8|+}}} evaluates to +. Parameter 9 is undefined, so {{{9|{{{8|-}}}}}} evaluates to {{{8|-}}}, and since parameter 8 isn't defined, {{{8|-}}} in turn evaluates to -. + and - are not equal, so the condition evaluates as false.
  • If 8 is defined and 9 is undefined: true
    • Parameter 8 is defined, so {{{8|+}}} evaluates to {{{8}}}. Parameter 9 is undefined, so {{{9|{{{8|-}}}}}} evaluates to {{{8|-}}}, and since parameter 8 is defined, {{{8|-}}} in turn evaluates to {{{8}}}. {{{8}}} and {{{8}}} are equal, so the condition evaluates as true.
  • If 8 is undefined and 9 is defined: false
    • Parameter 8 is undefined, so {{{8|+}}} evaluates to +. Parameter 9 is defined, so {{{9|{{{8|-}}}}}} evaluates to {{{9}}}. As {{{9}}} will not be set to + in practice, the two are not equal, so the condition evaluates as false. Note that this condition will not appear in an ordinary scenario, as unless the user specifies otherwise, parameter 8 will be defined before parameter 9.

Therefore this condition produces the answer of true if and only if parameter 8 is defined and parameter 9 isn't. We can use this to apply unique CSS to the tray based on how many items are in it.

Why not use nested ifs to do this instead? We could, but this method makes the code a bit shorter and easier to edit since there are fewer pipe symbols and close braces to keep track of.