Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Value-optional attributes
ruud wrote #301715:
Why not
$attribute = "1", to achieve better compatibility with existing plugins that do strict===comparisons?
Unfortunately, then <txp:if_variable name="test" value>... would not work, since "1"=="some value" is false, while true=="some value" is true.
Last edited by etc (2016-09-23 20:30:48)
Offline
Re: Value-optional attributes
etc wrote #301716:
Unfortunately, then
<txp:if_variable name="test" value>...would not work, since"1"=="some value"is false, whiletrue=="some value"is true.
But <txp:if_variable name="test"> would work and have the effect you intend while being shorter due to this bit of code:
if (!isset($atts['value'])) {
$x = true;
}
Offline
Offline
Re: Value-optional attributes
If you wanted to check for value emptyness, you’d set value="".
Offline
Offline