Yahoo it is me again. _(•̀ω•́ 」∠)_ ₎₎
I wanted to ask, would you happen to know if it's possible to add file redirects in templates? In particular, with the IBModel/IMModel templates, I'm wondering if something like, "If the file link exists, link to said file. If it doesn't exist, redirect to File:IBUnknown.png / File:IMUnknown.png" can be done?
Topic on User talk:Ritsu
Try using {{#ifexist:File:pagename|exists|does not exist}}
I... apologize, I seem to be having some difficulty getting this to work. If/When you have some free time, could I ask you to look over Template:ModelTest and let me know where I went wrong? >)-o
Can you provide an example of how you call it when it doesn't work?
Of... How I call it...? @@
Are you referring to calling the template via the {{ }} brackets? If so, it would be:
{{ModelTest
|IM=SWATBHat
|Lithia=yes
}}
...which should pull up File:SWATBHatLi.png. However, it either pulls up File:IMUnknown.png or a nonexistent link.
I see it now, you're checking if the page "SWATBHat" exists (since you only provided {{{IM|}}}), and not File:SWATBHatLi.png.
Maybe store it in a variable so that you can reuse it for both the condition of #ifexist and the outcome.
ooo... Thank you for your time, chief! Alas, I think this may be a bit beyond my current skill level. I will set this aside until I have a better understanding of wiki code. _(:3/
It's really easy though. I made an edit that should fix this.
O.
T-Thank you! |. v.)
I'm going to fiddle around with it a bit more before I copy it over to Template:IMModel.