Hi,
is there a way to store general information in a template and access parts of that information by a conditional call of the template?
An example could be a list of first name and surname of people working in defined positions in different departments. A template call to find out the Surname could then look like this
{{People_Info |Department=DepartementA |Position=Accountant |Surname}}
where DepartementA and Accountant define which surname has to be displayed.
I tried a lot with the parser functions #if and #ifeq but the result is not really satisfying.
Is there an 'easier' solution available?
Albert
Mediawiki wrote:
Hi,
is there a way to store general information in a template and access parts of that information by a conditional call of the template?
An example could be a list of first name and surname of people working in defined positions in different departments. A template call to find out the Surname could then look like this
{{People_Info |Department=DepartementA |Position=Accountant |Surname}}
where DepartementA and Accountant define which surname has to be displayed.
I tried a lot with the parser functions #if and #ifeq but the result is not really satisfying.
Is there an 'easier' solution available?
Albert
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
I don't know that you can do that. Your best bet would be store it in a MySQL / PostgreSQL DB and write an extension with a special page to access the database, and allow you to search it.
On Sunday 20 April 2008 18:54:55 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?
An example could be a list of first name and surname of people working in defined positions in different departments. A template call to find out the Surname could then look like this
{{People_Info
|Department=DepartementA |Position=Accountant |Surname}}
where DepartementA and Accountant define which surname has to be displayed.
I tried a lot with the parser functions #if and #ifeq but the result is not really satisfying.
You may try http://meta.wikimedia.org/wiki/Semantic_MediaWiki or http://www.mediawiki.org/wiki/Extension:Data .
On Sonntag, 20. April 2008, Nikola Smolenski wrote:
On Sunday 20 April 2008 18:54:55 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?
An example could be a list of first name and surname of people working in defined positions in different departments. A template call to find out the Surname could then look like this
{{People_Info
|Department=DepartementA |Position=Accountant |Surname}}
where DepartementA and Accountant define which surname has to be displayed.
I tried a lot with the parser functions #if and #ifeq but the result is not really satisfying.
You may try http://meta.wikimedia.org/wiki/Semantic_MediaWiki or http://www.mediawiki.org/wiki/Extension:Data .
Templates in Semantic MediaWiki are often combined with something like #ifeq to make parameters optional, which yields the infamous MediaWiki template mess of nested {{ }}. For examples that can be copied and pasted, see e.g. the templates on semanticweb.org (such as Template:Person).
-- Markus
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
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
Thanks for the hints. Unless I learn how to program my own extensions this will hopefully fit my purpose.
"Michael Daly" michael.daly@kayakwiki.org schrieb im Newsbeitrag news:480BAFD8.5030504@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
mediawiki-l@lists.wikimedia.org