Author Topic: Using lots of templates  (Read 5440 times)

Offline FlyingRagnar

  • Dragon Quest Wiki Staff
  • ***
  • Posts: 111
    • View Profile
    • Dragon Quest Wiki
Using lots of templates
« on: June 15, 2011, 04:21:12 AM »
I'd like some opinions on whether it is a good idea or a bad idea to use lots of templates to hold content.  I've found that there is a lot of content on the wiki which is duplicated in many places.  Rather than try to maintain all of them, it makes sense to dump it into a template, right?  Well, that results in a LOT of templates and subtemplates.  I'm wondering if following this strategy will end in performance issues with all the transcluding. 

For example, here is a template I recently redesigned:  http://dragon-quest.org/wiki/Template:DQIXQuest/3.  Each quest has a separate subtemplate identified by its number (1-184).  And here is an example of bad design: http://dragon-quest.org/w/index.php?title=Template:9E&action=edit.  This template holds all of the content which then gets transcluded each time it is called.  I know it needs fixed, but is creating 200+ subtemplates really the best design? 

Where is the line between using templates for repetitive content versus not having too many?

Offline SnorlaxMonster

  • Bulbapedia Staff
  • ***
  • Posts: 485
  • Gender: Male
  • Bulbapedia bureaucrat, Zelda Wiki administrator
    • View Profile
Re: Using lots of templates
« Reply #1 on: June 15, 2011, 12:20:23 PM »
From a technical perspective, you need to be careful not to go over the template include size. I believe it is one million templates, but if you have pretty tables and tonnes of subtemplates then this is quite achievable on long pages. For example, on Bulbapedia Battle CD used to have the parties of 50 Trainers, but went over the template include limit and ended up needing to be broken off into 3 subpages. The main cause of this on Bulbapedia is color templates (not that they are a bad thing).

This kind of problem is uncommon, and only applies on long pages, but is something you should consider before going template crazy.

Offline tacopill

  • Lylat Wiki Staff
  • ***
  • Posts: 3128
    • View Profile
    • csanimefan
Re: Using lots of templates
« Reply #2 on: June 19, 2011, 02:19:16 PM »
what you may want to do is come up with some "guideline numbers", of which help you determine if you need a template or not, and to an extent, whether or not you need to substitute or simply transclude the template.


This also raises questions, like:
* How often is the information across multiple pages?
* How important is the information to a specific page?
* Can the information be saved into a subpage of a specific main page?

After studying the information for a little while, i do have to say that the information is pretty organized, in terms of structure and readability of the information itself, and the use of sub-templating.

NintendoWiki has a similar idea, when it comes to sub-templating; however the games themselves would probably not be listed on multiple pages, so saving the information in a template would make little sense in that situation.

Similaraly, the Donkey Kong Arcade Game is considered by me, both a game in the Donkey Kong series and a Super Mario series. So, to help with this, i created a sub-page of the game's main page, in which imports the same information but chooses a random color scheme to show for the infobox.

Hope this helps.







Offline SnorlaxMonster

  • Bulbapedia Staff
  • ***
  • Posts: 485
  • Gender: Male
  • Bulbapedia bureaucrat, Zelda Wiki administrator
    • View Profile
Re: Using lots of templates
« Reply #3 on: June 20, 2011, 09:57:25 AM »
* Can the information be saved into a subpage of a specific main page?
I'm personally not really a fan of subpages. I generally feel they should be avoided unless necessary. You can make content expandable if it's making the page too long.

Quote
Similaraly, the Donkey Kong Arcade Game is considered by me, both a game in the Donkey Kong series and a Super Mario series. So, to help with this, i created a sub-page of the game's main page, in which imports the same information but chooses a random color scheme to show for the infobox.
That seems like a very inefficient way to do it. The content from Donkey Kong (game)/Infobox2 could just be placed on the page itself. But even then, couldn't you just put the infobox with something like this on the page?
Code: [Select]
|niwa={{#switch: {{#expr: {{#time: U}} mod 2}}|0=Super Mario Wiki|1=Donkey Kong Wiki}}
|colorscheme={{#switch: {{#expr: {{#time: U}} mod 2}}|0=mario|1=Donkey Kong}}

However, I would say that it is primarily a Donkey Kong game anyway; while it is a Mario game too, that is secondary.

Another (better) option would be to program the template to allow links to two wikis per game, which could be applied in other situations too; for example, the Mario vs. Donkey Kong series, Professor Layton vs. Ace Attorney, many G&W games (assuming we get Professor Layton, Ace Attorney, and Game & Watch wikis).

Offline tacopill

  • Lylat Wiki Staff
  • ***
  • Posts: 3128
    • View Profile
    • csanimefan
Re: Using lots of templates
« Reply #4 on: July 09, 2011, 06:20:59 PM »
yea.... i guess it is going overboard.... :). And i have completely forgotten about a time-based random choice generator, but i guess that is because i became too used to <choose> and <random>.  :laugh:.

Anyway, i am now implementing your suggestions.  :eekdance: