Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
gem_if_newer_than: Compare article date with a relative date
gem_if_newer_than is a plugin that offers a conditional tag that compares the article date with a relative date.
<txp:gem_if_newer_than weeks="2">
This article is newer than 2 weeks!
<txp:else/>
This article is not new!
</txp:gem_if_newer_than>
You can also include multiple attributes like this:
<txp:gem_if_newer_than days="2" hours="4" seconds="40">
This article is newer than 2 days, 4 hours and 40 seconds!
<txp:else/>
This article is not new!
</txp:gem_if_newer_than>
You can use the following attributes in the gem_if_newer_than tag:
weeks
years
months
days
hours
minutes
seconds
Plugin code to install:
# gem_if_newer_than v2007.10.10
# Conditional tag that compares the article date with a relative date.
# Henrik Gemal
# http://gemal.dk/
# ......................................................................
# This is a plugin for Textpattern - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# ......................................................................
H4sIAAAAAAAAA+1WTW/bOBA9m79iKvigbANbTr12oqzTLhbF7qHoafdQBIVBi5RNmPoAScUx
ivz3nSElW477cckxQIDMDPlm3pvRSObpJEm/2XSaRiUvZHRr08k8jdayWKp8WcqdNEu34SUd
YPxBGqsq7yEuukqS+WiS4B9FZmnEG7epjD++SqN/ZGnUFv6WBdcdJNxYNkb5CGI2ztXpeLym
WyOxHfv4JI2EtJlRtWvrza7T6K+qFIoCXIPja0BmDrKqqLmRFj0J3DiVaQmCOwk75TbAwUjN
nXoIwRHlQrVuX6NalSbB3Uhd08n19B06kxGcdYCxegQvQcAn+lI1kPESGis97MNZvQ+hQAVC
2VrzPeBRl92CKjGvUHkujSwd7Pj+mDN/BC4EnhNCZVVJWbjWR7SnjZTBlyO3hCvYSbm1UGlx
pPgrekhjXzXmoFor66Dma0knbqMsMUsZW2Uj+MM91ulZnlB1EV1FdwzgX4J0ydA85/eG+TxS
Wzn+LqJyhMJr4+/WuztpP9e2QqqZboSEotFO1ZiGO2fUqnHYKa220gv5uQjB914DbLAbaE0j
sBI7L8hOfi2N8JcwDXDgpYBp0mV4WcXdRPNK62qnynVfrR/aD6fdtsCPge0lN5YVVek2lhF9
5rmzQpWUirXk223LKuHfLTc36LC8KTNaovMli4f8T+csLFCg4fv44hKGHAUjzQV8/u/Tpwv4
xgZrXa1wAYc0l7YRt2wwzLrlxLs5TpaC8tEZnrlYU9o4JGWDQeRFRLC4g+SSfC+n5wdhvQBJ
7LlebP9+kN2LdA3oIl4Ksbi4ILI4h6V/RyxOdNxHdWWdFNHXW4a3MNrdWktHVnxA+jTYuiVx
pzTd5XuvJvoKbyEeemHwHlojheSA8xpPgRhqcaEBBGytPhKb8QyHkRZIjSKY/98HUctOUaGJ
ARaefMQF44Qn9fZZvbbdLdfgebKt2ceHSZwm6KYTErQeJejM53LfIjy8IN93xm8wp2t+UE4W
NVYotk4VOKNOL878oKC1Q4HugHrb2liltWhUveKn46dKR2mO+7qHm/dR0j46WWMOx54UgVQO
cQ94B8drfrNOl8iZhnboiQ2MdI0p8c1urIw/PnD9EdcrblcTWR9Q9HA/Mf8lDR/VpeG71w/r
64f19cP68h9W3KhC/O4t/LV9M0uuxTyZXvPZZDWZZvPZLJnmYi6SfHWTcRHdPv0PQPdJ2+4L
AAA=
Just reply if you got any feedback or questions
Offline
Re: gem_if_newer_than: Compare article date with a relative date
Interesting approach in defining version numbers :)
Offline
Re: gem_if_newer_than: Compare article date with a relative date
ruud wrote:
Interesting approach in defining version numbers :)
I would like the version number to be “1.0.20071010” but for some strange reason I can remember that the version number is truncated.
Offline
Re: gem_if_newer_than: Compare article date with a relative date
I think that column is limited to 10 characters in the txp_plugins table.
Offline
#5 2007-10-11 10:41:21
- Niconemo
- Member
- From: Rhône-Alpes, France
- Registered: 2005-04-18
- Posts: 557
Re: gem_if_newer_than: Compare article date with a relative date
The kind of small plugin that can be so useful sometimes.
Thank you Henrik.
Last edited by Niconemo (2007-10-11 10:41:40)
Nico
Offline