Search
Other Snippets questions
Forum

Snippet if syntax: If inside if / if this AND that

Eero L's Avatar Eero L
Hello,

Is there any way to put an IF condition inside another IF condition? Or create IF conditions only if two conditions are true (IF x AND y, then...)?

Something like this:

{if variablex}<a href="%variablex%">{if variabley}%variabley%{else}Click here{/if}</a>{/if}

or like this:

{if variablex and variabley}<a href="%variablex%">%variabley%</a>{/if}

Thank you!
Peter van Westen's Avatar Peter van Westen ADMIN
You can do:
{if variablex AND variabley}
Or:
{if variablex && variabley}

To pass if one of the 2 variables are there, you can use the OR:
{if variablex OR variabley}
Or:
{if variablex || variabley}
Please post a rating at the Joomla! Extensions Directory
Eero L's Avatar Eero L
Perfect, thank you Peter! I assume IF inside IF is not possible. But it doesn't matter now that I know the AND and OR exist.

I just bought the extension. I am very positive about this, I am sure it will help with many problems.
Peter van Westen's Avatar Peter van Westen ADMIN
Nested ifs are indeed not possible.

I am happy you like the extension 🙂
Please post a rating at the Joomla! Extensions Directory
Eero L's Avatar Eero L
Thank you for clarifying! 🙂
Eero L's Avatar Eero L
Ps. This AND/OR information should be added to the documentation. I am sure it would help many people like me.
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription