Hello Couch World!
I've run into this issue that I don't fully understand. I believe the logic is right but the vars I'm using in the if statement aren't.
These vars are coming from editables that are in a repeating region. That is why I need to enumerate the editables themselves as you'll see below. The user decides how many they want and their choice becomes the value of my cms:repeat kcount. All of those conditions work correctly.
TEMPLATE:
The values of 'button-style.htm':
square=
|rounded=rounded-capsule
|Left Icon Square=btn-icon btn-icon-left
|Left Icon Rounded=btn-icon rounded-capsule btn-icon-left
|Right Icon Square=btn-icon btn-icon-right
|Right Icon Rounded=btn-icon rounded-capsule btn-icon-righ
The IF statements on these editables work as expected inside the template.
What I need to do, since these editables will iterate through a cms:repeatable and populate one or more elements (butttons) on the front-end, I am using cms:set along with cms:concat to create the correct var name:
This pattern works like a charm on 9 other parameter settings, iterating as it should, outputting the correct chosen value where it should.
But I need a condition to output code on the front end only IF certain values are chosen.
When the value of hero_swpr_txtblk_c2a_st does not equal nothing AND does not equal 'rounded-capsule', I want to execute some code. Exactly like the function set to show/hide the text box in the template. That template function works correctly and now I need that for the front-end to show/hide some code. However, I can't seem to get the statement correct.
I believe the variable I'm using in the IF condition is wrong, because when I troubleshoot, no matter what I choose with != becomes TRUE and no matter what I say for = becomes FALSE. I've even taken away the && and make it a single.
I've tried so many combinations of cms:get, cms:show, cms:capture and I can't seem to get it right.
Does anyone have any experience with this? Can anyone see what it is that would make the if statement work with this kind of variable? Any support on this would be greatly appreciated.
I've run into this issue that I don't fully understand. I believe the logic is right but the vars I'm using in the if statement aren't.
These vars are coming from editables that are in a repeating region. That is why I need to enumerate the editables themselves as you'll see below. The user decides how many they want and their choice becomes the value of my cms:repeat kcount. All of those conditions work correctly.
TEMPLATE:
- Code: Select all
.....
<cms:editable type='dropdown' name='hero_swpr_txtblk_c2a_st_1' label='Button Style' desc=''
opt_values='dropdowns/button-style.htm'
dynamic='opt_values'
order='3135'
/>
<cms:func _into='hero_swpr_txtblk_c2a_icon_fa_chc_1' hero_swpr_txtblk_c2a_st_1=''>
<cms:if (hero_swpr_txtblk_c2a_st_1 !='') && (hero_swpr_txtblk_c2a_st_1 != 'rounded-capsule') >
show
<cms:else />
hide
</cms:if>
</cms:func>
<cms:editable type='text' name='hero_swpr_txtblk_c2a_icon_fa_icon_1' label='Button Icon' desc=''
not_active=hero_swpr_txtblk_c2a_icon_fa_chc_1
order='3137'
/>
....
<cms:editable type='dropdown' name='hero_swpr_txtblk_c2a_st_2' label='Button Style' desc=''
opt_values='dropdowns/button-style.htm'
dynamic='opt_values'
order='3146'
/>
<cms:func _into='hero_swpr_txtblk_c2a_icon_fa_chc_2' hero_swpr_txtblk_c2a_st_2=''>
<cms:if (hero_swpr_txtblk_c2a_st_2 !='') && (hero_swpr_txtblk_c2a_st_2 !='rounded-capsule') >
show
<cms:else />
hide
</cms:if>
</cms:func>
<cms:editable type='text' name='hero_swpr_txtblk_c2a_icon_fa_icon_2' label='Button Icon' desc=''
not_active=hero_swpr_txtblk_c2a_icon_fa_chc_2
order='3148'
/>
The values of 'button-style.htm':
square=
|rounded=rounded-capsule
|Left Icon Square=btn-icon btn-icon-left
|Left Icon Rounded=btn-icon rounded-capsule btn-icon-left
|Right Icon Square=btn-icon btn-icon-right
|Right Icon Rounded=btn-icon rounded-capsule btn-icon-righ
The IF statements on these editables work as expected inside the template.
What I need to do, since these editables will iterate through a cms:repeatable and populate one or more elements (butttons) on the front-end, I am using cms:set along with cms:concat to create the correct var name:
- Code: Select all
<cms:repeat count="<cms:show hero_swpr_txtblk_c2a_opt />" startcount='1' >
<cms:set hero_swpr_txtblk_c2a_st="<cms:concat 'hero_swpr_txtblk_c2a_st_' k_count />" "global" />
</cms:repeat>
This pattern works like a charm on 9 other parameter settings, iterating as it should, outputting the correct chosen value where it should.
But I need a condition to output code on the front end only IF certain values are chosen.
When the value of hero_swpr_txtblk_c2a_st does not equal nothing AND does not equal 'rounded-capsule', I want to execute some code. Exactly like the function set to show/hide the text box in the template. That template function works correctly and now I need that for the front-end to show/hide some code. However, I can't seem to get the statement correct.
- Code: Select all
<cms:if (hero_swpr_txtblk_c2a_st !='') && (hero_swpr_txtblk_c2a_st !='rounded-capsule') >
<span class="btn-brand">
<i class='<cms:show "<cms:get hero_swpr_txtblk_c2a_icon_fa_icon />" />'> </i>
</span>
</cms:if>
I believe the variable I'm using in the IF condition is wrong, because when I troubleshoot, no matter what I choose with != becomes TRUE and no matter what I say for = becomes FALSE. I've even taken away the && and make it a single.
I've tried so many combinations of cms:get, cms:show, cms:capture and I can't seem to get it right.
Does anyone have any experience with this? Can anyone see what it is that would make the if statement work with this kind of variable? Any support on this would be greatly appreciated.