Admin Forum:Template with if and two parameters

I've been trying for days to fashion a template to be used to link to another wiki (it's supposed to be an easier alternative to w:c:* ). All I want is for the template to replicate the normal wikilink function, with two parameters: And I actually managed to do that. Problem is, I also want the template to know when there is no second parameter, and use the first one instead: No dice. I've tried a lot of things, including #if, #ifelse, and #string. The output is either parameter 1 in both cases, or parameter 2 in both cases, or both parameters at once, or a copypaste of the template code. Nothing has worked and it's driving me batty. Any ideas? --Tulipclaymore 18:32, October 23, 2011 (UTC)


 * Do you mean something like ? This will use the name of the page if nothing is specified for the second parameter.


 * Um, yes. Exactly like that; fed that into my wiki and it works perfectly. Thank you.
 * I hadn't even thought of doing it like that. Just out of curiosity: is there a way for my approach to work (an if function that returns two different strings depending on whether a second parameter is given or not)? --Tulipclaymore 18:50, October 23, 2011 (UTC)


 * An if function would work, although it would be redundant in this case. Example:  --Gardimuer { ʈalk } 21:24, October 23, 2011 (UTC)