Template:Test2: Difference between revisions
imported>Flargen mNo edit summary |
imported>Foggy No edit summary |
||
(48 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
<includeonly>{{ | <includeonly><phptag> | ||
$first_letter_vowel = preg_match('/^[aeiou]/i',$argv[1]); | |||
$first_letter_cap = (preg_match('/^[A-Z]/',$argv[1])); | |||
if (isset($argv[2])) { | |||
if ($argv[2] == 'y') { | |||
$first_letter_cap = FALSE; | |||
} | |||
} | |||
if ($first_letter_vowel) { | |||
if ($first_letter_cap) { | |||
echo "An "; | |||
} else { | |||
echo "an "; | |||
} | |||
} else { | |||
if ($first_letter_cap) { | |||
echo "A "; | |||
} else { | |||
echo "a "; | |||
} | |||
} | |||
echo $argv[1]; | |||
</phptag></includeonly><noinclude> | |||
{{Code2}} | {{Code2}} | ||
==Instructions== | ==Instructions== | ||
Similar to the [[Sandbox]], this page is here for you to play around with templates. Do what you like with it, but please leave this explanatory section. | Similar to the [[TheKolWiki:Sandbox|Sandbox]], this page is here for you to play around with templates. Do what you like with it, but please leave this explanatory section. | ||
Insert your desired template contents above between the "includeonly" tags, and alter the instance below to include any parameters you may need. | Insert your desired template contents above between the "includeonly" tags, and alter the instance below to include any parameters you may need. You may need to [http://kol.coldfront.net/thekolwiki/index.php?title={{FULLPAGENAME}}&action=purge purge this page] to see the effects of changes to this template's code. The same also holds for any other template. Otherwise, you may have to wait several minutes before the wiki starts using the new code. | ||
Always give a template a category, even if it is [[:Category:Test Templates]]. For help on how a template works, read some [[MetaWikipedia:Help:Template|documentation]]. | Always give a template a category, even if it is [[:Category:Test Templates]]. For help on how a template works, read some [[MetaWikipedia:Help:Template|documentation]]. | ||
Current Test: | Current Test: leading article | ||
==Template Effects== | ==Template Effects== | ||
*{{Test2|igloo}} | |||
*{{Test2|Igloo}} | |||
*{{Test2|tent}} | |||
*{{Test2|Tent}} | |||
*{{Test2|Igloo|y}} | |||
*{{Test2|Tent|y}} | |||
[[Category:Test Templates]]</noinclude> | [[Category:Test Templates]]</noinclude> |
Latest revision as of 14:08, 9 June 2015
$first_letter_vowel = preg_match('/^[aeiou]/i',$argv[1]); $first_letter_cap = (preg_match('/^[A-Z]/',$argv[1])); if (isset($argv[2])) { if ($argv[2] == 'y') { $first_letter_cap = FALSE; } } if ($first_letter_vowel) { if ($first_letter_cap) { echo "An "; } else { echo "an "; } } else { if ($first_letter_cap) { echo "A "; } else { echo "a "; } } echo $argv[1];
</phptag>Instructions
Similar to the Sandbox, this page is here for you to play around with templates. Do what you like with it, but please leave this explanatory section.
Insert your desired template contents above between the "includeonly" tags, and alter the instance below to include any parameters you may need. You may need to purge this page to see the effects of changes to this template's code. The same also holds for any other template. Otherwise, you may have to wait several minutes before the wiki starts using the new code.
Always give a template a category, even if it is Category:Test Templates. For help on how a template works, read some documentation.
Current Test: leading article
Template Effects
- an igloo
- An Igloo
- a tent
- A Tent
- an Igloo
- a Tent