We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Dec 14, 2020 5:12 AM - edited Dec 14, 2020 5:12 AM
Does anyone know if it's possible to create an if statement that covers multiple options for the page editior?
I have a created a tabbed module to be reused for our various homes to show floorplans and dimensions which are displayed within the relevant tab (first floor, second floor, third floor) .
Depending on the house type selected, 1, 2 or 3 tabs will show. I will then target that specific house name selection to pull in the correct data within each tab.
For example
{% if module.house_name =='Bodnant','Oakfield','Stratford' %}
3 tabs displayed to represent each floor of a 3 storey - selected house name data displayed within each tab
{% elif module.house_name =='Wentworth','Thornbury','Windsor' %}
2 tabs displayed to represent each floor of a 2 storey - selected house name data displayed within each tab
{% else %}
1 tabs displayed to represent bungalow - selected house name data displayed within sole tab
{% endif %}
Unfortunately this doesnt work. Is there a workaround? Ideally I dont want to have multiple if statements to cover every house name.
Solved! Go to Solution.
Dec 14, 2020 2:34 PM
Hey @ben-duchy
You'll want to use the logical OR operator.
{% if module.house_name =='Bodnant' or module.house_name =='Oakfield' or module.house_name =='Stratford' %}
3 tabs displayed to represent each floor of a 3 storey - selected house name data displayed within each tab
{% elif module.house_name =='Wentworth' or module.house_name =='Thornbury' or module.house_name =='Windsor' %}
2 tabs displayed to represent each floor of a 2 storey - selected house name data displayed within each tab
{% else %}
1 tabs displayed to represent bungalow - selected house name data displayed within sole tab
{% endif %}
Dec 14, 2020 2:34 PM
Hey @ben-duchy
You'll want to use the logical OR operator.
{% if module.house_name =='Bodnant' or module.house_name =='Oakfield' or module.house_name =='Stratford' %}
3 tabs displayed to represent each floor of a 3 storey - selected house name data displayed within each tab
{% elif module.house_name =='Wentworth' or module.house_name =='Thornbury' or module.house_name =='Windsor' %}
2 tabs displayed to represent each floor of a 2 storey - selected house name data displayed within each tab
{% else %}
1 tabs displayed to represent bungalow - selected house name data displayed within sole tab
{% endif %}
Dec 16, 2020 4:44 AM
That's Perfect @Kevin-C just what I needed. Thanks 😀