[Mediawiki-l] Store data in an template

Mediawiki albert.cremer at online.de
Mon Apr 21 17:49:26 UTC 2008


Thanks for the hints.
Unless I learn how to program my own extensions this will hopefully fit my 
purpose.

"Michael Daly" <michael.daly at kayakwiki.org> 
schrieb im Newsbeitrag news:480BAFD8.5030504 at kayakwiki.org...
> Mediawiki wrote:
>
>> is there a way to store  general information in a template and access 
>> parts
>> of that information by a conditional call of the template?
>
> You can do this if you put a long list of #if statements in another
> template and nest them accordingly.
>
> For example if you have template DepartmentHeads, you could have
>
> {{ #ifeq: {{{1}}} | Dept X | Smith }}
> {{ #ifeq: {{{1}}} | Dept Y | Jones }}
> {{ #ifeq: {{{1}}} | Dept Z | Davis }}
> etc.
>
> Template PhoneNumbers could have
>
> {{ #ifeq: {{{1}}} | Smith | (888) 555-1234 }}
> {{ #ifeq: {{{1}}} | Jones | (888) 555-4321 }}
> {{ #ifeq: {{{1}}} | Davis | (888) 555-1221 }}
> etc.
>
> Then just include that in the outer template:
>
> The head of {{{dept}}} is {{ DepartmentHeads|{{{dept}}} }}
> They can be contacted at {{ PhoneNumbers|{{ 
> DepartmentHeads|{{{dept}}} }} }}
>
> This is a tedious way to create templates as a quasi-database, but if
> the data is small in quantity and fairly static over time, it works and
> avoids building an extension.
>
> Mike 






More information about the MediaWiki-l mailing list