FANDOM


Item Pages as Databeses

Every page can contain data that can be called from other pages

<onlyinclude>{{#switch: {{lc:{{{1|}}}}}
 |name = Sorcerer
 |image = Sorcerer.jpg
 |quality = Rare
 |b = 1
 |t = 2
 |i = 3
 |type = Body
 |special = 8% to harass when defending
 |text = This is a test
 |seals = pp++-
 }}</onlyinclude>{{ItemCard|{{PAGENAME}}}}
  • The switch function enclosed in onlyinclude tags (colored in blue) contains all the data, it's the database (the onlyinclude tags tell the wiki to only take the info enclosed by them when transcluding, thus you can add more info outside and it won't damage the functionality.
  • {{ItemCard|{{PAGENAME}}}} is calling the template that creates the card from the info within the page (a modified version of Template:Item Card), this can be done on other pages by simply changing {{PAGENAME}} into the name of the page that you want create a card for, in our case → {{ItemCard|Test/Sorcerer}}

Sorcerer
Sorcerer

Item Border Silver

Battle Icon 2 1
Trade Icon 2 2
Intrigue Icon 2 3
Body Icon Body
Rare
Sealbar-silver
Seal Peerless Icon
Seal Peerless Icon
Seal Add Icon
Seal Add Icon
Seal Lock Icon

8% to harass when defending
This is a test

  • I created a modified version of Template:Production Item that takes the info from the page entered
    under | Result = ?
  • The following text is us calling the template:

{{Template:test/production
|result = Test/Sorcerer <!-- name of the page -->
|silver = 800
|time = 15h
|building = Godswood
|upgrade = Pool
|resource1 = Weirwood
|resource1_qual = rare <!-- would have been taken from the wood page -->
|resource1_qty = 5
|resource2 = Lead
|resource2_qual = uncommon <!-- same as above -->
|resource3_qty = 2
|resource3 = Breastplate
|resource3_qual = uncommon <!-- same as above -->
|resource2_qty = 10
}}

{{Template:test/production              1
|result = Test/Sorcerer                 2
|silver = 800                           3
|time = 15h                             4
|building = Godswood                    5
|upgrade = Pool                         6
|resource1 = Weirwood                   7
|resource1_qty = 5                      8
|resource2 = Lead                       9
|resource3_qty = 2                      10
|resource3 = Breastplate                11
|resource2_qty = 10                     12
}}                                      13

{{Template:Production Item              1
|name = Sorcerer                        2
|silver = 800                           3
|time = 15h                             4
|quality = rare                         5
|building = Godswood                    6
|upgrade = Pool                         7
|battle = 1                             8
|special = 8% to harass when defending  9
|trade = 2                              10
|intrigue = 3                           11
|type = Body                            12
|resource1 = Weirwood                   13
|resource1_qual = rare                  14
|resource2 = Lead                       15
|resource2_qual = uncommon              16
|resource3 = Breastplate                17
|resource3_qual = uncommon              18
|resource1_qty = 5                      19
|resource2_qty = 10                     20
|resource3_qty = 2                      21
}}                                      22


Using Template:test/production

Sorcerer
Silver Icon 800
Time Icon 15h
Sorcerer
Iconview Silver Dark

Resource Icon Sleeve
Building Icon Godswood
Upgrade Icon Pool
Battle Icon 2 1 8% to harass when defending
Trade Icon 2 2
Intrigue Icon 2 3
Body Icon Body
Required Resources
Weirwood
Iconview Silver Dark

Resource Icon Sleeve
Lead
Iconview Silver Dark

Resource Icon Sleeve
Breastplate
Iconview Silver Dark

Resource Icon Sleeve
5 Weirwood 10 Lead 2 Breastplate

using Template:Production Item

Sorcerer
Silver Icon 800
Time Icon 15h
Sorcerer
Iconview Silver Dark

Resource Icon Sleeve
Building Icon Godswood
Upgrade Icon Pool
Battle Icon 2 1 8% to harass when defending
Trade Icon 2 2
Intrigue Icon 2 3
Body Icon Body
Required Resources
Weirwood
Iconview Silver Dark

Resource Icon Sleeve
Lead
Iconview Silver Dark

Resource Icon Sleeve
Breastplate
Iconview Silver Dark

Resource Icon Sleeve
5 Weirwood 10 Lead 2 Breastplate

Summary (as I see it)

Pros:

  • Reduces redundancy
  • Easily withdraw data from items
  • Changes in stats/info are global[1]

Cons

  • Takes time to get used to it
  • Must force refresh first time a page is created[2]
  • Can cause to reach node limit[3]
  • May prevent the wiki from noticing there are images for the thumbnails in category pages

Another Thing - Autocategorization

Although it's not entirely relevant to this blog page, I'd also suggest using autocategorization of pages by the templates they use, this is in order to both make sure a page is categorized correctly, and let you change categories globally (see note #1 below). It is possible to autocategorize into many categories example: Sorcerer can be autocategorized based on the data you enter to: Companions, Peerless Companions, Intrigue Companions, Trade Companions and more (depending on the data you enter).


Sorry for the length and thanks for reading


Notes

  1. ie. change just once to edit all pages that use the data
  2. That's because the page uses a cached version of itself, to force refresh you just add ?action=purge to the address
  3. on pages with hundreds of transclusions - there are several ways to avoid this but I can confirm that this method works on another wiki with a page that transcludes 208 items, displaying 10 parameters from each albeit it can be a bit laggy to save a page like that that much data once you edit it - that's more than 2080 quaries in one page!, no lag on pages with a bit less than that amount The two methods are:
    1. use slightly different syntax to create a page that sends all the parameters to a template of your choosing, that way it converts checking a switch function several times with a way to call templates with all the parameters. this will avoid reaching the node count even with thousands of calls
    2. using the tab view tags - this renders the pages instead of transcluding them, in this way you can display several heavy pages without reaching the limit

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.