draganr
I'm new here

Fallback for the content

Jump to solution

Dear All,

I wanna to create a fallback for the content.

I want to use English Page content on the French site.

english-headline.jpgfrench-headline.jpg

      <CMS_INPUT_TEXT name="st_headline" hFill="yes" singleLine="no" useLanguages="yes">

        <LANGINFOS>

          <LANGINFO lang="*" label="Headline" description="Insert the section headline."/>

        </LANGINFOS>

      </CMS_INPUT_TEXT>

then i set up

$CMS_VALUE(masterLang, #global.project.masterLanguage)$

$CMS_VALUE(#global.language, masterLang)$

but no success. Nothing shows up.

Do you have any advice?

Thanks,
Dragan

0 Kudos
1 Solution

Accepted Solutions

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

View solution in original post

0 Kudos
7 Replies
brueder
I'm new here

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 Kudos

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 Kudos

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 Kudos

Hi Rene,

I am using project languages.
comm.jpg

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

0 Kudos

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 Kudos

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 Kudos
draganr
I'm new here

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 Kudos