0

I'm having a really strange problem with an EE if statement being used in conjunction with transcribe (may or may not be related).

I have a field that lets a user submit a hex colour to change the background colour of a box. By default it's red because of the style called "promoBox_red". On the english side of the site the entries are all applying the hex colour added in the entry via the IF statement. As soon as I switch to French the default style "promoBox_red" is what takes over. I can't even get the IF statement to run.

Any thoughts? Completely baffled.

{exp:channel:entries channel="footer_promos" limit="3"}
        <div align="center" class="col-xs-4 promoBox_red" {if background_colour_hex_number_6_d !=""}style="background-color: #{hex_number};"{if:else}style="background-color: #ef4034;"{/if}>
            <img src="{footer_promo_image}" alt="{title}" title="{title}">
            <a href="{footer_promo_link}" class="btn btn-default btn-sm" role="button" title="{title}" style="margin-top: 20px;">{exp:transcribe:replace name="scribe_button_learn_more"}</a></p>
        </div>
{/exp:channel:entries}
2
  • 1
    What version of ExpressionEngine? Conditionals had a major rewrite in 2.9.0. Mar 3, 2015 at 14:26
  • I can't make sense of your conditional. The background color is the field hex_number, right? So what's the field background_colour_hex_number_6_d?
    – Sobral
    May 2, 2015 at 13:11

2 Answers 2

0

I had a parse order issue when using mutiple plugins since the {if} would render before other ee calls.

Just in case, please try

{if '{background_colour_hex_number_6_d}' !=""}

Sometimes you have to add quotes.

1
  • Hey Chris, Thank you for response. It's very much appreicated. Sadly the quotes don't seem to work. I'm going to try to look into the parse order that you mentioned above. Thanks in advance. Dec 3, 2014 at 17:47
0

I'm also confused by your variable check (ie you're checking for one thing and outputting another) but I'm assuming that there's a reason for it. Have you tried a simple boolean check? eg

{if background_colour_hex_number_6_d}{hex_number}{if:else}#color{/if}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.