We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6561
    • 139 Posts
    I’m trying to use the same template for different languages, so far so good. However, currently I’m stuck on following problem:

    - A multilingual website with e.g. English pages in folder ’English’ and Dutch pages in folder ’Nederlands’
    - I have an ajaxSearch call in my template with a non-ajaxSearch call
    - I have a result page for English language and one for Dutch language (and more languages to come)

    My problem is that I would like to send the user to the proper search result page for her language. For example, if the user uses the search from a page that is in the English section, send her to the ’English Search Results’ page. If the user searches from a page that is in the Dutch (’Nederlands’) folder, send her to the ’Dutch Search Results’ page.

    For other things, I used ’UltimateParent’ snippet, but it seems that is not sufficient here. I thought about using some logic such as: ’if UltimateParent is equal to 1 then searchresultpage=10’ and ’if UltimateParent is equal to 2 then searchresultpage=20’ and so on for other languages.

    I don’t really know where to start though...  huh

    As an alternative, I could duplicate the template, but that effectively doubles the amount of templates I’d have to manage... so I don’t think that would be such a good idea.




      • 29076
      • 615 Posts
      One of the ways to do that is to have a TV connected to your template containing two calls to two different chunks, one for the AjaxSearch with language set to English and the English landing page, and the other with the language set to Dutch and the Dutch landing page. And then use @inherit in that TV on your root parent document for each language.

      Place that TV in the place for the AjaxSearch call in your template.
        I think, thererfor I am! But what I am, and why...?
        • 6561
        • 139 Posts
        Quote from: Sylvaticus at Mar 28, 2009, 09:48 AM

        One of the ways to do that is to have a TV connected to your template containing two calls to two different chunks, one for the AjaxSearch with language set to English and the English landing page, and the other with the language set to Dutch and the Dutch landing page. And then use @inherit in that TV on your root parent document for each language.

        Place that TV in the place for the AjaxSearch call in your template.

        Thank you.
        But, could you please elaborate a bit? I’m not understanding your explanation fully... I made a chunk called ’SearchResultsEN’ with content:
        [!AjaxSearch? &whereSearch=`content` &ajaxSearch=`0` &language=`english` &AS_landing=`58`!]


        And I made another chunk ’SearchResultsNL’ with content:
        [!AjaxSearch? &whereSearch=`content` &ajaxSearch=`0` &language=`nederlands` &AS_landing=`30`!]


        Then I created a TV called ’SearchResultWhichLang’ and in the input box with the TV’s value in the ’english’ and ’nederlands’ folder I put @inherit.

        But I don’t understand where and how it would call the snippets - and how it decides which of the two snippets it should execute.


          • 29076
          • 615 Posts
          Replace the call for the AjaxSearch call in your template with the SearchResultWhichLang-TV.

          Edit the SearchResultWhichLang-TV and set the Input Option Values to {{SearchResultsEN}}||{{SearchResultsNL}}. You may set Input Type to Radio Options for easier access in your documents. Then set the Default Value to @INHERIT. Save.

          In the English folder (parent-document), set the value for the SearchResultWhichLang-TV to {{SearchResultsEN}} or choose it with the Radio Option if you use that.

          In the Nederlands folder (parent-document), set the value the for SearchResultWhichLang-TV to {{SearchResultsNL}} or choose it with the Radio Option if you use that.

          No every child-document under the English folder should be given the call to the SearchResultsEN-chunk and by that put the correct snippet call in the template.

          Note: You may not see the chosen value in the child-documents, it follows the parent-value "invisible". But it’s there.

          Good luck! smiley
            I think, thererfor I am! But what I am, and why...?
            • 6561
            • 139 Posts
            Thanks a bunch, Sylvaticus! Works like a charm!

            So let’s see if I understand now:

            - the two different (AjaxSearch) calls are defined in the two different chunks.
            - the TV holds the values of the chunks and that || is a bit like ’OR’ operator? And... the radio buttons aren’t really necessary but they are useful to make selecting easier.
            - and on the parent folder (English, Dutch), you set the TV, pick the proper value and the @inherit makes sure all of the children (pages) inherit this value.
              • 29076
              • 615 Posts
              Quote from: Darkelve at Mar 29, 2009, 07:33 AM

              Thanks a bunch, Sylvaticus! Works like a charm!

              So let’s see if I understand now:

              - the two different (AjaxSearch) calls are defined in the two different chunks.
              - the TV holds the values of the chunks and that || is a bit like ’OR’ operator? And... the radio buttons aren’t really necessary but they are useful to make selecting easier.
              - and on the parent folder (English, Dutch), you set the TV, pick the proper value and the @inherit makes sure all of the children (pages) inherit this value.
              It’s all correct. I’m  sure there are other ways to do this also, but this should work.  smiley
                I think, thererfor I am! But what I am, and why...?