Aller au contenu principal

Fallback for the content

Commentaires

7 commentaires

  • Zendesk API User
    Author: brueder - 3/29/2018 16:50

    Hi Dragan,

    what you want to achieve is possible. Try this:

    $CMS_VALUE(st_headline, default: #global.section.formData.get(#global.project.masterLanguage, "st_headline").get)$

    The above code does not handle null values correctly, but is easier to reason about. the below one also handles null values correctly:

    $CMS_SET(set_headline, #global.section.formData.get(#global.project.masterLanguage, "st_headline"))$

    $CMS_VALUE(st_headline, default: if (!set_headline.isEmpty,  set_headline.get))$

    If you want to re-use the code, it's a good idea to put it in a render-template.

    Does that help you?

    Cheers,

    Lena

    0
  • Zendesk API User
    Author: draganr - 3/30/2018 9:07

    Hi Lena,

    Ah, almost. You see, by that code i get headline from the "master" section template.

    I have one section (st_section_list_with_sub_navigation) which has:

    • st_headline
    • st_list (FS_LIST)

    Within st_list i chose another section template (st_download_list_product), which has, again,

    • st_headline

    The above code gives me: st_headline from the st_section_list_with_sub_navigation

    So, i probably need something like this:

    $CMS_VALUE(st_headline, default: #this.formData.get(#global.project.masterLanguage, "st_headline").get)$

    But, that does not work.

    Thanks for your help. This code helped me for some other stuff.

    Kind regards,

    Dragan

    0
  • Zendesk API User
    Author: rednoss - 4/5/2018 9:38

    Hi Dragan,

    is there a specific reason why you arrange your forms in CMS_GROUPs (one for each language) instead of using project languages?

    Best regards,

    René

    0
  • Zendesk API User
    Author: draganr - 4/10/2018 13:19

    Hi Rene,

    I am using project languages.

    I just need english content on the, for example, French site...

    0
  • Zendesk API User
    Author: pavone - 4/19/2018 10:01

    Hello Dragan,

    I think you are almost there. In your case #this is a FormData object. Therefore this should work:

    $CMS_VALUE(st_headline, default: #this.get(#global.project.masterLanguage, "st_headline").get)$

    Regards,

    Tim

    0
  • Zendesk API User
    Author: sebastianc - 4/30/2018 15:05

    Hello Dragan,

    do you need further help or did Tim's reply already help you? If so, it would be great if you marked

    his reply as "correct answer" so that other community users find the solution easily. If you have

    already found a solution by yourself, it would be very kind of you, if you posted it here.   

    Best regards,
    Sebastian

    0
  • Zendesk API User
    Author: draganr - 5/7/2018 15:04

    Hello Tim, Sebastian,

    First of all sorry for the late response.
    I was pretty busy and i had couple of days off.

    $CMS_VALUE(st_headline, default: #this.get(#global.project.masterLanguage, "st_headline").get)$

    This is the correct answer. Thank you Tim very much.

    Best regards,

    Dragan

    0

Vous devez vous connecter pour laisser un commentaire.