[Mediawiki-l] ParserFunction #ifeq can't be nested(?) - any other approach?
Rolf Lampa
rolf.lampa at rilnet.com
Tue Apr 3 13:56:50 UTC 2007
Hi all,
I'm making a template attempting to get ParserFunctions to determine
assigned parameters for me, but it seems like I can't nest multiple
#ifeq-functions.
Imagine the template {{pseudoimage}}, it should be able to properly
handle multiple params:
{{pseudoimage|image name.jpg}}
{{pseudoimage|image name.jpg|thumb}}
{{pseudoimage|image name.jpg|thumb|65px}}
{{pseudoimage|image name.jpg|thumb|65px|left}}
{{pseudoimage|image name.jpg|thumb|65px|left|Well, descriptive text}}
The first case to test is easy, and it works:
Test 1: {{{1}}} = image name:
{{#ifexist:[[Image:{{{1}}}]]|[[Image:{{{1}}}]]|[[Category:Image missing]]}}
----
Test 2: ( same as above, plus checking for SECOND param - works )
{{#ifexist:[[Image:{{{1}}}]]|
{{#ifeq:{{{2}}}|""|[[Image:{{{1}}}]]|[[Image:{{{1}}}|{{{2}}}]]}}
|[[Category:Image missing]]}}
----
Test 3: ( same as above, plus checking for THIRD param - does NOT work)
{{ #ifexist:Image:{{{1}}} |
{{ #ifeq:{{{2}}} | "" | [[Image:{{{1}}}]] |
{{ #ifeq:{{{3}}} | "" | [[Image:{{{1}}}|{{{2}}}]] |
[[Image:{{{1}}}|{{{2}}}|{{{3}}}]] }}
}}
| [[Category:Image missing]]
}}
----
So now, how can I achieve something like this. I need to check at least
five parameters (I think). Any ideas of other ways to achieve the same goal?
Regards,
// Rolf Lampa
More information about the MediaWiki-l
mailing list