CMS Development

Sandyv_
Member

Problems with HubL if/else statement

I've created a module using the if/else statement. 
I use the if/else statement to change icons. So whenever a variable is equal to ex. "starter", the icon changes to a "S" icon. This works when there's only ONE of the modules on a template.
I use the module multiple times, and that is where the issue comes. 
Whenever I add another module of the same, on a template, the module underneath the first module, uses the same icon as the first module even though I changed the variable. I can see that the variable changes but the icon doesn't change. 

Sample code:

{% if widget.type_of_plan == 'starter' %}
ICON IMAGE 1
{% elif widget.type_of_plan == 'commerce' %}
ICON IMAGE 2
{% else %}
ICON IMAGE 3
{% endif %}



Does anyone have a clue what is wrong? Or experienced the same?

0 Upvotes
2 Replies 2
roisinkirby
HubSpot Product Team
HubSpot Product Team

Problems with HubL if/else statement

Hey @Sandyv_ apologies for the delay. Are you still experiencing this roadblock? If so, could you plese post a link to the page you are working on?

0 Upvotes
Sandyv_
Member

Problems with HubL if/else statement

Hi, 

 

I solved the problem. I had an issue with my images. 🙂 

0 Upvotes