I've two issues I've been bashing my head against for the last few days and finally decided to put it out to the list as a whole. I'm working on an increasingly complex template and I'm hoping you guys might be able to provide some easy answers.
1) Is it possible to put comments into a template? Something that will only show up on the edit screen for the template, not on the 'view' tab and not when the template is used?
2) Is it possible to assign a parameter value to a parameter within the template? Basically, what I'm trying to do is to use an ifeq statement to provide output based on one of three possible parameter values. For example:
Let's assume the only parameter passed from the calling page is a value for "pet". The two values expected are "dog" or "fish". If the parameter value passed is "dog", then I'd want to assign breathes=air, legs=4 and teeth=yes. If the parameter value from 'pet' is "fish", I'd want breathes=water, legs=0 and teeth=none. Later on in the same template, I'd want to put the values for breathers, legs and teeth into a table.
Now I know I could just put the ifeq statement within the cell in the table, but that's going to quickly get repetitive and cumbersome, resulting in a vary nasty and complex page under the 'edit' tab. I'm hoping for something a bit more elegant and efficient.
Thanks for any assistance you can provide.
R. William Morris Lucifer@infernaldreams.com
Hi Rodney,
2009/12/2 Rodney Morris lucifer@infernaldreams.com:
I've two issues I've been bashing my head against for the last few days and finally decided to put it out to the list as a whole. I'm working on an increasingly complex template and I'm hoping you guys might be able to provide some easy answers.
- Is it possible to put comments into a template? Something that will
only show up on the edit screen for the template, not on the 'view' tab and not when the template is used?
Try wrapping the comments in <includeonly><noinclude></noinclude></includeonly>
- Is it possible to assign a parameter value to a parameter within the
template? Basically, what I'm trying to do is to use an ifeq statement to provide output based on one of three possible parameter values. For example:
Let's assume the only parameter passed from the calling page is a value for "pet". The two values expected are "dog" or "fish". If the parameter value passed is "dog", then I'd want to assign breathes=air, legs=4 and teeth=yes. If the parameter value from 'pet' is "fish", I'd want breathes=water, legs=0 and teeth=none. Later on in the same template, I'd want to put the values for breathers, legs and teeth into a table.
Now I know I could just put the ifeq statement within the cell in the table, but that's going to quickly get repetitive and cumbersome, resulting in a vary nasty and complex page under the 'edit' tab. I'm hoping for something a bit more elegant and efficient.
Create a 'public' interface template that accepts pet parameter and then calls the actual technical template that uses the breathes, legs and teeth parameters (in addition to the pet parameter)
Rodney Morris wrote:
I've two issues I've been bashing my head against for the last few days and finally decided to put it out to the list as a whole. I'm working on an increasingly complex template and I'm hoping you guys might be able to provide some easy answers.
- Is it possible to put comments into a template? Something that will
only show up on the edit screen for the template, not on the 'view' tab and not when the template is used?
Normal wiki comments <!-- --> work on templates.
- Is it possible to assign a parameter value to a parameter within the
template? Basically, what I'm trying to do is to use an ifeq statement to provide output based on one of three possible parameter values. For example:
Let's assume the only parameter passed from the calling page is a value for "pet". The two values expected are "dog" or "fish". If the parameter value passed is "dog", then I'd want to assign breathes=air, legs=4 and teeth=yes. If the parameter value from 'pet' is "fish", I'd want breathes=water, legs=0 and teeth=none. Later on in the same template, I'd want to put the values for breathers, legs and teeth into a table.
Not directly. But you can have your template call a more general parent template to which it provides the number of legs and teeth.
mediawiki-l@lists.wikimedia.org