1

I'm trying to display a phrase based on the language_code This is the code:

{exp:channel:entries
    channel="offerte"
    disable="categories|category_fields|member_data|pagination|trackbacks"
    dynamic="no"        
}


{if language_code="it"}
    {if no_results}
        <p>Nessuna offerta al momento</p>
    {/if}
{/if}

{if language_code="en"}
    {if no_results}
        <p>No offers at the moment</p>
    {/if}
{/if}       


    <h6>{title}</h6>
    <p>{descrizione}</p>

{/exp:channel:entries}

the result is that it is shown only the phrase with language_code it , even if language_code is en

how can i resolve it? Thanks

5
  • Where is the language code coming from? Is it a custom field or is this MSM with different sites for each language?
    – Ian Young
    Apr 27, 2013 at 8:52
  • Is a variable inside index.php and en/index.php Apr 27, 2013 at 8:56
  • Also, how many entries are you expecting returned? Just output {language_code} between your Channel Entries tag pair to see the value of that tag and how many entries you get returned.
    – Ian Young
    Apr 27, 2013 at 8:57
  • Are you following this kind of thing for a multi-language site?
    – Ian Young
    Apr 27, 2013 at 8:58
  • Resolved. I changed the code to this gist.github.com/redmile/8ad34e36bca85a7b3502 Thanks Ian Apr 27, 2013 at 9:09

1 Answer 1

1

Resolved. I created a variables and changed the code to this

{exp:channel:entries
    channel="offerte_{language_code}"
    disable="categories|category_fields|member_data|pagination|trackbacks"
    dynamic="no"        
}


    {if no_results}
        {nessuna_offerta-{language_code}}           
    {/if}   


    <h6>{title}</h6>
    <p>{descrizione}</p>

{/exp:channel:entries}

Your Answer

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

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