We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22851
    • 805 Posts
    Quote from: Frank at Nov 17, 2009, 02:11 PM

    I also am wondering how to use flags for language selection. Sorry if I read over a possible threads with a solution, but modx search does not seem to function in the forum,

    You should be able to do something like this (untested):
    [[YAMS? &get=`repeat` &beforetpl=`@code:<ul>` &repeattpl=`otherFlagItemTpl` &currenttpl=`currentFlagItemTpl` &aftertpl=`@code:</ul>`]]

    where otherFlagItemTpl is a chunk that contains
    <li class="yams_lang_(yams_id)"><a href="(yams_docr)" lang="(yams_tag)" xml:lang="(yams_tag)" dir="(yams_dir)" title="(yams_name_in_(yams_id+))"><img alt="(yams_name)" src="[(site_url)]assets/images/flags/(yams_id).png"/></a></li>
    

    (a linked flag image) and currentFlagItemTpl is a chunk that contains
    <li class="yams_lang_(yams_id) yams_current"><img alt="(yams_name)" src="[(site_url)]assets/images/flags/(yams_id).png"/></li>
    

    (an unlinked flag image) and you have flag images with the format (yams_id).png in the directory assets/images/flags/.

    EDIT: Corrected typo. otherflagItemTpl -> otherFlagItemTpl
      YAMS: Yet Another Multilingual Solution for MODx
      YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
      Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
      • 10313
      • 375 Posts
      Works like a charme, except for one typo: In the snippet code it must be "otherFlagItemTpl" with a capital "F" for Flag, like the chunk name you have proposed.

      Thanks for this again
      Martin
        • 22851
        • 805 Posts
        Brilliant. Thanks. That explains why Joeeey is only seeing one flag.
          YAMS: Yet Another Multilingual Solution for MODx
          YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
          Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
          • 25862
          • 9 Posts
          Quote from: PMS at Nov 18, 2009, 01:45 AM

          You should be able to do something like this (untested):
          [[YAMS? &get=`repeat` &beforetpl=`@code:<ul>` &repeattpl=`otherFlagItemTpl` &currenttpl=`currentFlagItemTpl` &aftertpl=`@code:</ul>`]]

          Sorry, but I’m a super-beginner. Where should I put this code?
            • 10313
            • 375 Posts
            You should put it where you want these flags.
              • 22851
              • 805 Posts
              The best place to put it is somewhere within a document template. That way the list of flags will appear on every document that uses the template. If you select a document from the document tree you can check which template it is using. The templates themselves can be found and edited at Elements>Manage Elements>Templates.
                YAMS: Yet Another Multilingual Solution for MODx
                YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
                Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
                • 25483
                • 741 Posts
                ronaldlokers Reply #7, 14 years ago
                Somehow the above code is not working on YAMS 1.1.7 alpha RC7. Everything works, but I got no output at the href part.
                  with regards,

                  Ronald Lokers
                  'Front-end developer' @ h2o Media

                  • 10313
                  • 375 Posts
                  It works very well on my website/server. Wich version of PHP are you using?
                    • 25483
                    • 741 Posts
                    ronaldlokers Reply #9, 14 years ago
                    PHP 5.2.10, but a older version of YAMS does work ok on the same server (the problem is that I need the newest version for this new site)
                      with regards,

                      Ronald Lokers
                      'Front-end developer' @ h2o Media

                      • 22851
                      • 805 Posts
                      Odd. Are you using multilingual aliases, and if so, have you given each language variant of your document an alias? If that’s not the problem then I’ll have to do some experimentation and get back to you, in which case it would also be useful to know whether your document(s) is cacheable or uncacheable and which version of MODx you have installed.

                      Cheers.
                        YAMS: Yet Another Multilingual Solution for MODx
                        YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
                        Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.