The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
Hello all,
Does anybody knows what's wrong with: Code:
<vb:if condition="{vb:raw item_premium}==1">checked</vb:if> Maria |
#2
|
||||
|
||||
![]() Code:
<vb:if condition="$item_premium =='1'">CHECKED</vb:if> OR <vb:if condition="$item_premium ==1">CHECKED</vb:if> don't forget to register $item_premium. |
#3
|
|||
|
|||
![]() Quote:
Merry Christmas to you and to your family Maria |
#4
|
|||
|
|||
![]() Quote:
|
#5
|
|||
|
|||
![]() Quote:
Also, the first option would check if $item_premium is equal to the string 1, whereas the second would check if $item_premium is equal to the boolean 1 (i.e. "true"). |
#6
|
|||
|
|||
![]()
Wouldn't it only do that if he had three equals? In php I ma under the assumption that == '1' is the same as == 1. You'd need to do === 1 for numbers, === '1' for string and === true for boolean as far as I know.
|
#7
|
|||
|
|||
![]()
I've managed to use 2 equals signs for boolean in the past via PHP.
I'm not sure about conditions, but I've used it in PHP before. |
#8
|
|||
|
|||
![]()
It would match booleans yes but it would also match the string or number representation. == in PHP is non type specific. i.e. it looks for values that match without checking the types. You use === if you want to make sure the type is the same as well i.e. both sides of the conditional are boolean or numerical etc. So if you wanted to make sure that something was true but not the number 1 or '1' then you'd need to do: if ($condition === true) because if you just had == then it would match with '1' or 1 too.
I barely ever need to check that the type matches as well but I thought it best to point that out. |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|