Infoboxes with optional rows is the very first thing that comes to mind, though that particular use would only be applicable if we had infoboxes for specific types of entities, e.x. units.
Consider, for example, an infobox for SC1 units. We may have a field for subunit type and capacity for units like Carriers and Reavers, but because this field doesn't apply to all units, it'd be best if we had some way to hide it. The
#if ParserFunction grants this functionality: if the field is left undefined when the (presently hypothetical) template is called, then the row would not be displayed.
Along a similar vein, we could have an "Evolves from" field for Zerg units only; a "Morphs into" field for units that can change form (be they Zerg Drones or even the two types of Terran Siege Tank); a "Unit capacity" field for both transport units and buildings like Terran Bunkers; etc., and these fields would only ever be shown on the infoboxes for the specific units they apply to.
The
#ifeq function has similar uses. Again using the example of a unit infobox, we could display different supply icons based on the race.
#ifexist could be used to detect if a specified unit portrait exists, and display a placeholder image if it does not.
[1]Oh, and I meant to link to the
ParserFunctions extension, not to the list of all parser function extensions.
[1] If we really wanna go overboard, we could even do this inside of the infobox, for unit portraits:
{{#ifexist: File:{{PAGENAME}}.png | [[File:SC1 Unit Portraits - {{PAGENAME}}.png]] | [[File:SC1 Unit Portraits - Missing.png]] }}
This would take the title of the current page (using the PAGENAME magic word), use that to generate a filename (such as
File:SC1 Unit Portraits - Terran Command Center.png), and check if that file has been uploaded to the wiki. If not, it would output a placeholder image (
File:SC1 Unit Portraits - Missing.png). The effect would be that we wouldn't need to specify the location of a unit portrait -- it would be automatically included. This is, of course, assuming that all unit portraits adhere to the naming convention "
File:SC1 Unit Portraits - <name>.png".)
We totally don't have to do that, but it's a good demonstration of some of the lower-level things you can do with templates and ParserFunctions.
Post has been edited 1 time(s), last time on Apr 27 2010, 11:02 pm by DavidJCobb. Reason: Fixed page stretching
None.