FANDOM


(Created page with "I am still trying to figure out what exactly it is you want it to do. At this time it seems like your script won't ever add the .gif extension. It reads the avatar-parameter, ...")
 
 
(One intermediate revision by one user not shown)
Line 2: Line 2:
 
At this time it seems like your script won't ever add the .gif extension. It reads the avatar-parameter, when it is not empty, .png will be added. When it is empty, .gif will be added. This won't ever work because the only case you will get .gif as output would be when there was no image inserted at all.
 
At this time it seems like your script won't ever add the .gif extension. It reads the avatar-parameter, when it is not empty, .png will be added. When it is empty, .gif will be added. This won't ever work because the only case you will get .gif as output would be when there was no image inserted at all.
   
#if: works this way:
+
<nowiki>#if:</nowiki> works this way:
{{#if: test string | value if test string is not empty | value if test string is empty}}
+
<nowiki>{{#if: test string | value if test string is not empty | value if test string is empty}}</nowiki>
   
If you want to check what extension avatar has, use {{#sub:{{{avatar}}}|-3}}
+
If you want to check what extension avatar has, use <nowiki>{{#sub:{{{avatar}}}|-3}}</nowiki>
 
This will return the last 3 characters of avatar, which would be the png, jpg and gif suffixes.
 
This will return the last 3 characters of avatar, which would be the png, jpg and gif suffixes.
 
From there on, you can use these for if-statements or switch-cases, any way you prefer.
 
From there on, you can use these for if-statements or switch-cases, any way you prefer.

Latest revision as of 16:17, January 7, 2013

I am still trying to figure out what exactly it is you want it to do. At this time it seems like your script won't ever add the .gif extension. It reads the avatar-parameter, when it is not empty, .png will be added. When it is empty, .gif will be added. This won't ever work because the only case you will get .gif as output would be when there was no image inserted at all.

#if: works this way: {{#if: test string | value if test string is not empty | value if test string is empty}}

If you want to check what extension avatar has, use {{#sub:{{{avatar}}}|-3}} This will return the last 3 characters of avatar, which would be the png, jpg and gif suffixes. From there on, you can use these for if-statements or switch-cases, any way you prefer.

I feel I haven't answered your question yet, so I would like to see some more information on how you want to use this. Link to example pages where possible.

Community content is available under CC-BY-SA unless otherwise noted.