Last active
October 11, 2015 07:27
-
-
Save notacouch/3823770 to your computer and use it in GitHub Desktop.
Note on Expression Engine Add-on Mo' Variables and get:* in conditions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Testing how Mo Variables works with conditions | |
<code>id: {get:id}. {if "{get:id}" == ""}1{/if}{if "{get:id}" != ""}2{/if}{if get:id}3{if:else}4{/if}{if "{get:id}"}got id{/if}{if "{get:id}" == 0}0{/if}</code> | |
<pre> | |
{!-- | |
url: / | |
result: id: . 4 | |
url: /?id= | |
result: id: . 140 | |
url: /?id=a | |
result: id: a. 23got id0 | |
In other words: | |
"{get:id}" == "" | |
closest approximation may be $_GET['id'] === "" (because $... == "" is like empty($...)) | |
"{get:id}" == 0 | |
is like isset($_GET['id']) | |
{if}{if:else}{/if} | |
is like !empty / empty | |
There is no actual equivalent to empty without using the advanced conditional if:else. | |
Ergo in most cases you want to use if:else. | |
--} | |
</pre> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment