Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: If related articles
etc wrote #334934:
Both
(int)
cast andintval()
function return0
afaik.
So if that’s the case and any non-numeric input or empty input results in 0, maybe we should do the same when escaping to int?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online
Re: If related articles
Bloke wrote #334935:
So if that’s the case and any non-numeric input or empty input results in 0, maybe we should do the same when escaping to int?
That’s what we do, and I think it’s all right. The question is whether empty strings should be removed before escaping? If yes, we loose the possibility to transform empty strings to numeric 0
. If no, empty strings will be wrapped, unless trim
is set. I guess we could trim empty strings by default, unless escape
is set:
<txp:hide process="1" wraptag="b"></txp:hide> <!-- outputs nothing -->
<txp:hide process="1" wraptag="b" escape="integer"></txp:hide> <!-- outputs <b>0</b> -->
If one wants to remove empty strings before escaping, he can explicitly set trim
:
<txp:hide process="1" trim wraptag="b" escape="integer"></txp:hide> <!-- outputs nothing -->
Offline
Re: If related articles
That sounds pretty darn logical to me.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online
Offline
Re: If related articles
Tried, unsuccessfully, to follow the thread, so…
First, thank you for related_articles. I must’ve missed this hitting the tags, and it’s pretty boss.
Second, os if_related_articles coming in 4.9? (Is that what the above chat meant?)
Offline
Re: If related articles
agovella wrote #335581:
is if_related_articles coming in 4.9?
No plans to do so. But you can now use txp:evaluate as mentioned above to test for it, in a cleaner manner under 4.9.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online