On 24/05/05, Rik Wade rik@rikwade.com wrote:
[...] However, every day, the number of cars would vary between 0 and n. Is there a way of building this sort of variable in to a template so that it can be called with a different number of colours (in this example) for each car in the queue?
No, I'm afraid not - parameters have to be explicitly referred to within the template. There have been calls for optional parameters, or even more complex "macro"-like structures, but there has been resistance amongst the core developers to introducing too much complexity and ending up with the template code acting as an interpretter for a whole new language.
The best you can do in the meantime is pass the parameters empty, and style your template so it doesn't look too ugly with them missing. In the example you give, it would make sense to use un-named parameters ({{{1}}}, {{{2}}}, {{{3}}}, etc), so that you could call the template as something like {{car colours|red|blue|green| | | | | | | | | | | }} (where the template actually always displays 10 colours, but here leaves the last 7 as " ")