We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17802
    • 190 Posts
    Hello,

    I have this feeling this is a really basic question, but I’ve racked my brain and searched the forums and I still haven’t found an answer.

    So, this is what I want to do. I’ve got a TV that can have 1 of 3 possible values ("en", "fr" or "nl"). Then there’s another TV that can also have 1 of 3 different values: "{{header-en}}", "{{header-fr}}"or "{{header-nl}}". If the value of the first TV is "fr", I want the second TV to automatically be "{{header-fr}}", etc.

    Is that even possible? And if so: how?? I’m sorry if it’s a stupid question, I’m doing my best, but I’m not a programmer...

    Thanks for your attention wink
      Thanks for MODx - I love it!
      • 7253
      • 97 Posts
      Not sure if there is, but there may well be a better way to do whatever it is you’re trying to do - can you post the code that you’re using and explain what you’re trying to achieve?
        • 17802
        • 190 Posts
        Thx for your speedy reply! Yeah, no doubt there’s an easier way grin

        I’ve built a site (in dutch) and now my client wants it to go multilingual.
        So in the site tree I made a folder for each new language (french and english) and inside these folders I’m going to copy the dutch pages and then replace the content with the translations.

        I would like to re-use the same templates, but some parts of my templates are in dutch. For example, a template starts like this:
        {{header}}
        <title>Dutch pagetitle</title>
        </head>


        The header chunk has dutch content as well, meta tags and stuff. So I thought:
        - I create a TV that specifies the language for each page
        - The TV value will be inherited from the parent folder ("en" or "fr")
        - Based on the language, the right header chunk is automatically inserted into the template.

        This way I can use the same template for different languages and not end up using 30 or so different templates (which is confusing for the administrators).

        So - where did I go wrong (if at all)? Any leads would be great!

          Thanks for MODx - I love it!
          • 32646
          • 87 Posts
          You may just want to rethink how you are doing the template a little bit. Put the Title outside the Content, like this:

          <title>[(site_name)] | [*pagetitle*]</title>


          Page title is set in Document settings.

          I also have a TV that tells me what the language is so I can do different things with search and MaxiGallery:

          [!AjaxSearch? &parents=`[[UltimateParent]]` &language=`[*Lang*]`!]


          The great thing is you can use DocManager or SuperFast to set all TV’s below a certain folder:

          Set all TV Lang below DocID 299 to en.

          I am even using the Lang TV for document language:

          <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="[*Lang*]" lang="[*Lang*]" dir="ltr">
            Just learning the ropes.
            • 17802
            • 190 Posts
            Thanks guys, for your helpful replies!
            I’ve never written a snippet before... but maybe this is a good time to learn. And I didn’t know about DocManager and SuperFast, I’ll look into that, too.
              Thanks for MODx - I love it!