Template:Test2: Difference between revisions
imported>Foggy No edit summary |
imported>Foggy No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly><phptag> | <includeonly><phptag> | ||
$first_letter_vowel = preg_match('/^[aeiou]/i',$argv[1]); | $first_letter_vowel = preg_match('/^[aeiou]/i',$argv[1]); | ||
$first_letter_cap = (preg_match('/^[A-Z]/',$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_vowel) { | ||
if ($first_letter_cap) { | if ($first_letter_cap) { |
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