Jump to content

Template:Ttl/doc

From Worldwide Dead Wiki
This is a documentation subpage for Template:Ttl.
It contains usage information, categories, and other content that is not part of the original template page.

Usage

{{ttl|ttl}}
{{ttl|ttl|timestamp}}
Parameter Description
ttl The number of days before timestamp is considered old.
timestamp Timestamp value to check for age.
The timestamp must be in the format YYYYMMDDHHIISS.
Use {{subst:LOCALTIMESTAMP}} when filling this template.

It uses the latest Revision timestamp as default.

This template will check if a given timestamp is within a specified number of days, and return a 1 if the timestamp is still valid, or 0 if invalid.

Example

// check if the latest revision is within the ttl of 2 days
{{ttl|2}}

0 <-- this should be a ZERO after Apr/10

// check if the current local timestamp is within the ttl of 2 days
{{ttl|2|{{subst:LOCALTIMESTAMP}}}}

1

// check if yesterday is within the ttl
{{ttl|2|{{#expr: {{LOCALTIMESTAMP}} - 1000000}}}}

1

// check if 2 days ago is within the ttl
{{ttl|2|{{#expr: {{LOCALTIMESTAMP}} - (2*1000000) }}}}

1

// check if 3 days ago is within the ttl
{{ttl|2|{{#expr: {{LOCALTIMESTAMP}} - (3*1000000) }}}}

0