Template:Job table: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
<div class=smwtable-exterior>{{#ask:[[Category:{{{cat|Television stories}}}]] [[{{{job1|{{PAGENAME}} }}}::+]] {{#if:{{{job2|}}}|| OR [[{{{job2}}}::+]]|}} | <div class=smwtable-exterior>{{#ask:[[Category:{{{cat|Television stories}}}]] [[{{{job1|{{PAGENAME}} }}}::+]] {{#if:{{{job2|}}}|| OR [[{{{job2}}}::+]]|}} | ||
|?{{{job1|{{PAGENAME}} }}} | |?{{{job1|{{PAGENAME}} }}} | ||
{{#if:{{{job2|}}}| | {{#if:{{{job2|}}}|{{!}}?{{{job2|}}}|}} | ||
|limit=500 | |limit=500 | ||
|format={{{format|broadtable}}} | |format={{{format|broadtable}}} |
Revision as of 19:01, 13 May 2012
- {{job table head}}, the template that creates the table headers
- {{job table foot}}, the template that closes the template
- {{job table core}}, the template that formats the data in the main body of the template
- {{job table}}, the template that actually gets put on pages
Usage
Default variables
By default, this template assumes that it is working on all pages within the broad category, category:television stories. It also assumes that you are attempting to tabulate information about the property that has the same name as the page name.
These assumptions can both be changed.
Simplest case
In most instances, you would just place {{job table}} on a page and be done with it. As long as the page name matches the name of the property name, you don't really need to do much else.
If I typed {{job table}} on the page 3D artist, it will automatically generate a table which was formatted like the rest of our infoboxes and tables. On the list would be all the 3D artists who had been credited on any episode of any television show that this wiki covers.
You can see this most dramatically by choosing a more ubiquitous title like writer.
The list always appears in a collapsed state — a condition which cannot be changed by using this template. Also the list is organised in alphabetical order of the title of the story, but it respects {{TitleSort}}. This means that articles at the beginning of titles are not considered during alphabetisation.
More complicated cases
When the {{PAGENAME}}
doesn't match the property name
Maybe the name of the page you're working on is visual effects producer but the property is Property:VFX producer. In this case, you'll have to make a slight modification: {{job table|job1=VFX producer}}. This ability to change the property name comes in handy when you want to drop on of these tables onto a completely different page, as was done above with the table of writers.
When there's a lot of output
For some of the more ubiquitous titles, like writer, you'll probably want to break the table down into smaller tables — logically, one for each show. Or maybe you're working on a series page where you want to show only the writers for that particular series. In these cases you'll want to narrow the category down. For instance, {{job table|job1=DOP|cat=Series 5 (Doctor Who) stories}} will show you all the directors of photography for series 5.
Limitations
As of May 2012[update], there are a lot of limitations. At present, you can only categorise one element. This means you can't sort by the story number or the series number — nor can you put, say, directors and cinematographers in the same table — all of which would clearly be desirable. You also can't affect the titles in the headers.
However, none of these problems is likely insoluble. And there's certainly a way to do all of that with SMW, manually. These functionalities have merely not been integrated into this template as of yet.
How it works
General comments
This template is powered by SMW, a powerful extension to the standard MediaWiki software which allows the creation of truly relational data. A large part of the reason this template works is because properties have been applied to {{wales crew}}. This means that all the work that has been done on filling out credits on story pages has not been a vanity project. Now we are armed with a vast and complicated database of information about the people who have worked on Doctor Who since 1996. Our database on 1963-era Doctor Who still needs to be built.
Specifics of the template
This template uses a standard #ask: query, but then pumps the results through three additional templates. The head of the tables is created by {{job table head}}, while {{job table foot}} closes the table. The guts — that is, the nitty-gritty of format each row of text — is handled by {{job table core}}.
It looks like this:
1. {{#ask:[[Category:{{{cat|Television stories}}}]] [[{{{job1|{{PAGENAME}} }}}::+]] 2. | ? {{{job1|{{PAGENAME}} }}} 3. |limit=500 4. |format=template 5. |template=job table core 6. |introtemplate=job table head 7. |outrotemplate=job table foot }}
To put this into plain English:
- asks of a category, usually Television stories, what are the names of all the people who did job1?
- creates a column with the names of the people who did the job1 (or, if undefined, the job with the name of the page)
- limits the output to 500 people
- sets the format of the output to template, meaning that it will pump the output through a template
- defines the name of the template handling the bulk of the data, in this case {{job table core}}
- defines which template is called before the first line of raw data. In other words, it calls the template that creates the template headers. At a minimum, this template must have {| in it.
- defines what comes after the last line of raw data. In other words, it call the template that closes the template. At a minimum, this template must have |} in it.