Quick intro: I've had a web presence since 1996 and have hosted/used MediaWiki since 2004. I wrote one of the first RSS aggregators (AmphetaDesk) and later lead the call to get Atom named Atom. I've written tech articles for Apple, a year-long magazine column for MacTech, books, blogs, and editing for O'Reilly, and am currently a full-time Drupal developer lead for one of the largest Drupal sites (Examiner.com). I've talked about the differences between Drupal and MediaWiki, and why I chose MediaWiki "going forward", at http://www.disobey.com/node/1866.
I was invited to the list by sumanah from #mediawiki, based on my template hacking and my input on mw:Lua_scripting (forthcoming). She figured that someone 'ere might be interested in how I've used templates and how I've solved some of my problems.
The wiki in question is the Disobiki at http://www.disobey.com/wiki/.
If you read the above post comparing Drupal/MediaWiki, this is my "me" wiki, my brain dump, my interests, my "it's not really a 'site', it's just a digital locker where I keep mah shiznitz."
One of the projects I've been working on randomly for years is the "Film Death and Sleaze Index" - that is, a catalog of deaths and sleazes inside genre films. The subject matter, of course, is roughly irrelevant to this discussion, but serves solely to introduce what you might be seeing as you poke around. The latest iteration of an index page is at:
http://www.disobey.com/wiki/The_Dead_Hate_the_Living!
----
== AUTOMATICALLY CREATED IMAGE GALLERIES ==
Granted, Category: does this already and I depend on it too:
http://www.disobey.com/wiki/Category:Posters_and_covers http://www.disobey.com/wiki/Category:Posters_and_covers_for_2000
In this case, all my files are named in a specific way such that the filenames function as proper captions to the images. This is just fine for a mass category like this, when the film titles should be displayed next to the image.
I also have per-film pages though. Take a look at:
http://www.disobey.com/wiki/Snapdragon
Here, we're seeing a list of images associated to this film.
The film's name is not listed in the caption. We know what film we're on.
This image gallery is automatically generated with DPL:
<DPL> namespace = File linksto = Snapdragon format = <gallery widths="200px">,%PAGE%|{{FilenameToCaption|%TITLE%|Snapdragon|1993}}\n,,</gallery> </DPL>
But, the filenames that worked so nicely in a Category: media display are bad to show here, because the most important information is later on in the filename - whether it's a DVD, a Poster, what language or region it's from, etc. I created {{FilenameToCaption}} to take a filename and munge it so only the important stuff is shown:
http://www.disobey.com/wiki/Template:FilenameToCaption
It uses nested #replaces from StringFunctions to remove junk bits.
== AUTODEFAULTSORT ==
Another template I've created and is in use on most "type of" pages is:
http://www.disobey.com/wiki/Template:AutoDEFAULTSORT
It just pushes "A " and "The " to the end of the DEFAULTSORT magic word.
It uses RegexFunctions and StringFunctions.
== NUMERIC SORTING ==
And the reason that brought me into #mediawiki this morning:
http://www.disobey.com/wiki/Category:Body_counts
Category sorting is string-based. Fine. Of course, that caused 1, 20, 21, 2, etc. I couldn't easily solve this by just editing the "Body count: 2" category, because the value of that page is all handled via a simple default-strings/category-setting template. It was a relatively simple fix to get the sort in a more expected way:
{{#ifexpr: {{{1}}} > 10 | [[Category:Body counts]] | [[Category:Body counts|Body count:0{{{1}}}]] }}
----
Anyways, those are recent and reusable little templates I've made lately.
As expected, you can see 'em all at:
http://www.disobey.com/wiki/Category:Templates
but most of the others are too site-specific or banal for discussion.