I have tried the following snippets for testing whether an 'OR' condition gets satisfied in sightly.
Solved! Go to Solution.
Views
Replies
Total Likes
Below is one of the way to check OR condition in HTL.
<sly data-sly-test.roottitle="fr"/>
<p data-sly-test="${roottitle != 'en'|| roottitle != 'es'}">${roottitle}</p>
In the first line i'm setting the value fr to the variable roottitle. In the second line i'm printing roottitle only if it not equal to en or es. Let me know if you have any further questions.
Thanks
Below is one of the way to check OR condition in HTL.
<sly data-sly-test.roottitle="fr"/>
<p data-sly-test="${roottitle != 'en'|| roottitle != 'es'}">${roottitle}</p>
In the first line i'm setting the value fr to the variable roottitle. In the second line i'm printing roottitle only if it not equal to en or es. Let me know if you have any further questions.
Thanks
Hi @arjunsudhas1995
If you are fetching the roottitle from properties you can simply use :
<div class="mytest"> <sly data-sly-test="${properties.roottile != 'root' || properties.roottile != 'roottitle1'}"> Inside rootTitleCond </sly> <sly data-sly-test="${properties.roottile != 'root' || 'roottitle1'}"> Inside rootTitleCondnEW </sly> </div>
Both the conditions work for me. Make sure you use proper whitespacing before and after operators like I have used. Otherwise, sightly will fail to work
Thanks
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies