2

I'm working on an old EE1 site at the moment.

It's multi-lingual using this approach from Carl http://cwcrawley.co.uk/2010/01/multi-lingual-websites-in-expressionengine/ with English, Chinese, Japanese & Korean versions.

I have a conditional in a template that looks like

{if description_{user_language} != ""}{description_{user_language}}{if:else}{description_en}{/if}

where {description_en} etc is an LG TinyMCE field. It works fine.

However, the client wants a better WYSIWYG and so, naturally, we'd like to use WYGWAM. So after installing WYGWAM and configuring the custom fields, our conditional renders the page blank. As soon as we remove the conditional it's fine (missing the content of course but has pinpointed the cause).

I can't think of a way around this or why it's happening.

Any suggestions?

  • Even if I hardcode the user_language I still get the same issue. This isn't a problem in EE 2 which I tested to work as I'd expect. – Steven Grant Sep 4 '13 at 19:13
  • 1
    can't you skip the if:else ? e.g. descr_{user_lang}{if descr_{user_lang}==""}{descr_en}{/if} and have you tried quotes? e.g. {if "{descr_{user_lang}}"==""} – GDmac Sep 4 '13 at 19:24
  • What error is showing in PHP logs? – Anna_MediaGirl Sep 5 '13 at 11:12
1

I know this seems completely elementary, but I have dealt with a lot of EE1 sites that give fits and find that sometimes, it's as simple as adding quote around the value you are comparing in your logic. So something like this might work in your case:

{if "{description_{user_language}}" != ""}
    {description_{user_language}}
{if:else}
    {description_en}
{/if}
| improve this answer | |
  • 2
    Thanks fella. You're right although the != was didn't work so ended up switching it to read {if '{description_{user_language}}' == ""}{description_en}{if:else}{description_{user_language}}{/if} - bizarre – Steven Grant Sep 6 '13 at 9:02
  • Glad you got it sorted. – W3bGuy Sep 6 '13 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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