Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2020-05-22 12:02:15
- kuopassa
- Plugin Author
- From: Porvoo, Finland
- Registered: 2008-12-03
- Posts: 210
- Website
if_variable greater than
Inside an article
form I have defined this variable: <txp:variable name="counter" add="1" output="0" />
I’d like to have an arrangement that does this: <txp:if_variable name="counter" value='>8'>loading="lazy"</txp:if_variable>
… But of course that code isn’t working. :-/
Is there an easy way to make that work?
Offline
#2 2020-05-22 13:05:00
- etc
- Developer
- Registered: 2010-11-11
- Posts: 4,051
- Website
Re: if_variable greater than
IIRC, in 4.8 you can use match="pattern"
attribute, like for custom fields:
<txp:if_variable name="counter" match="pattern" value="9|\d\d" ... />
Otherwise, this should work too:
<txp:evaluate query='<txp:variable name="counter" /> > 8'>
yep
<txp:else />
nope
</txp:evaluate>
Offline
#3 2020-05-22 13:36:18
- kuopassa
- Plugin Author
- From: Porvoo, Finland
- Registered: 2008-12-03
- Posts: 210
- Website
Re: if_variable greater than
Yes, thanks for the code examples. The one with evaluate
works fine. :-]
Offline
Pages: 1