Difference between revisions of "Template:Birthday"
Line 11: | Line 11: | ||
-->{{#vardefine:birthcat | -->{{#vardefine:birthcat | ||
|{{#if:{{{1|}}}<!-- If you fill in the birthday --> | |{{#if:{{{1|}}}<!-- If you fill in the birthday --> | ||
− | |{{#switch: {{str_find|{{#var: | + | |{{#switch: {{str_find|{{#var:birthmonth}}}}<!-- Check whether the month appears in position 2 or 3 --> |
| 2 | | 2 | ||
− | | 3 = {{#if: {{str_endswith|{{#var: | + | | 3 = {{#if: {{str_endswith|{{#var:birthday}}}}<!-- Check whether the day appears in the last position --> |
| {{#var:birthyear}}[[:Category:{{#var:birthdate}}|{{#var:birthdate}}]]{{ArticleCategory|{{#var:birthdate}}}}<!-- If it meets the requirements, it shows the date category (Year without category internal link) --> | | {{#var:birthyear}}[[:Category:{{#var:birthdate}}|{{#var:birthdate}}]]{{ArticleCategory|{{#var:birthdate}}}}<!-- If it meets the requirements, it shows the date category (Year without category internal link) --> | ||
− | | {{#if: {{str_endswith|{{#var: | + | | {{#if: {{str_endswith|{{#var:birthnumber}}}}<!-- Fault tolerance: check whether there is a number in the last position --> |
− | | {{#var:birthyear}}[[:Category:{{Str_crop|{{#var: | + | | {{#var:birthyear}}[[:Category:{{Str_crop|{{#var:birthday}}|1}}|{{#var:birthdate}}]][[Category:{{Str_crop|{{#var:birthday}}|1}}]]<!-- If yes, change the number to the day in the category --> |
− | |{{{1}}}{{#if:{{{ft|}}}||{{ArticleCategory|Incorrect birthday}}}}<!-- If | + | |{{{1}}}{{#if:{{{ft|}}}||{{ArticleCategory|Incorrect birthday}}}}<!-- If the number does not meet the requirements, "Incorrect birthday" is displayed--> |
}} | }} | ||
}} | }} |
Latest revision as of 00:38, 20 September 2023
This is an auxiliary template for birthday projects for [Characterinfo] and other related templates.
The purpose is to automatically identify and generate birthday categories. Incorrect birthday pages can be found in the Category:Incorrect birthday. If you don't want to display the incorrect birthday category, you can invoke the fault tolerance by adding the parameter value ft=true, or don't use this template, and use the "Special birthday" parameter in [Characterinfo] instead.
Usage instructions
1, {{Birthday|June 30}}
June 30
2, {{Birthday|December 1, 1998}}
December 1, 1998
3, {{Birthday|4|25}}
4
Related templates
- {{hair color}}: For hair colors
- {{eye color}}: For eye colors
- {{age}}: For the age
- {{horoscope}}: For the zodiac sign