Template:ScheduledContent
From HeRO Wiki
A template to show content based on the server time.
Shows the content only if current time is between start_time
and end_time
.
The page cache has to be purged (either manually or automatically) for the content to be shown properly.
Usage
{{ScheduledContent|start_time=|end_time=|content=|alt_content=}}
- Either
start_time
orend_time
has to be defined. - Named parameters can be omitted.
-
alt_content
optional.
Example
{{ScheduledContent|2017-01-01 00:01 JST|2017-12-31 23:59 JST|This text is only visible in 2017!}} {{ScheduledContent|2018-01-01 00:01 JST|2018-12-31 23:59 JST|This text is only visible in 2018!}} {{ScheduledContent|2019-01-01 00:01 JST|2019-12-31 23:59 JST|This text is only visible in 2019!}} {{ScheduledContent|2000-01-01 00:00 JST|2999-12-31 23:59 JST|This text is only visible in year 2XXX!}}
- {{
#vardefine: start_time | {{#time: U | 2017-01-01 00:01 JST }}
}}{{
#vardefine: end_time | {{#time: U | 2017-12-31 23:59 JST }}
}}{{
#vardefine: current_time | {{#time: U | now }}
}}{{
#ifexpr: (({{#var: start_time}} < {{#var: current_time}}) + ({{#var: current_time}} < {{#var: end_time}})) = 2 | This text is only visible in 2017! |
}}
- {{
#vardefine: start_time | {{#time: U | 2018-01-01 00:01 JST }}
}}{{
#vardefine: end_time | {{#time: U | 2018-12-31 23:59 JST }}
}}{{
#vardefine: current_time | {{#time: U | now }}
}}{{
#ifexpr: (({{#var: start_time}} < {{#var: current_time}}) + ({{#var: current_time}} < {{#var: end_time}})) = 2 | This text is only visible in 2018! |
}}
- {{
#vardefine: start_time | {{#time: U | 2019-01-01 00:01 JST }}
}}{{
#vardefine: end_time | {{#time: U | 2019-12-31 23:59 JST }}
}}{{
#vardefine: current_time | {{#time: U | now }}
}}{{
#ifexpr: (({{#var: start_time}} < {{#var: current_time}}) + ({{#var: current_time}} < {{#var: end_time}})) = 2 | This text is only visible in 2019! |
}}
- {{
#vardefine: start_time | {{#time: U | 2000-01-01 00:00 JST }}
}}{{
#vardefine: end_time | {{#time: U | 2999-12-31 23:59 JST }}
}}{{
#vardefine: current_time | {{#time: U | now }}
}}{{
#ifexpr: (({{#var: start_time}} < {{#var: current_time}}) + ({{#var: current_time}} < {{#var: end_time}})) = 2 | This text is only visible in year 2XXX! |
}}
Single Date
{{ScheduledContent|2018-01-01 00:01 JST|content=This content will be visible in 2018 and onwards!}} {{ScheduledContent|2030-01-01 00:01 JST|content=This content will be visible in 2030 and onwards!}} {{ScheduledContent|end_date=2019-01-01 00:01 JST|content=This content will be disappear after 2018!}}
- {{
#vardefine: start_time | {{#time: U | 2018-01-01 00:01 JST }}
}}{{
#vardefine: end_time | {{#time: U | 2999-12-31 23:59 UTC }}
}}{{
#vardefine: current_time | {{#time: U | now }}
}}{{
#ifexpr: (({{#var: start_time}} < {{#var: current_time}}) + ({{#var: current_time}} < {{#var: end_time}})) = 2 | This content will be visible in 2018 and onwards! |
}}
- {{
#vardefine: start_time | {{#time: U | 2030-01-01 00:01 JST }}
}}{{
#vardefine: end_time | {{#time: U | 2999-12-31 23:59 UTC }}
}}{{
#vardefine: current_time | {{#time: U | now }}
}}{{
#ifexpr: (({{#var: start_time}} < {{#var: current_time}}) + ({{#var: current_time}} < {{#var: end_time}})) = 2 | This content will be visible in 2030 and onwards! |
}}
- {{
#vardefine: start_time | {{#time: U | 1970-01-01 00:01 UTC }}
}}{{
#vardefine: end_time | {{#time: U | 2999-12-31 23:59 UTC }}
}}{{
#vardefine: current_time | {{#time: U | now }}
}}{{
#ifexpr: (({{#var: start_time}} < {{#var: current_time}}) + ({{#var: current_time}} < {{#var: end_time}})) = 2 | This content will be disappear after 2018! |
}}