Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
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
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
Re: if_variable greater than
Yes, thanks for the code examples. The one with evaluate
works fine. :-]
Offline
Pages: 1