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

    I’m implementing this on my own site at the meoment and so far so good, I especially like the ultimateparent, very neat trick.
    I do however have a problem with my Ajax search which has stopped working since I moved it underneath one of the languages folder, any ideas?
      • 25803 ☆ A M B ☆
      • 721 Posts
      I quite like this solution. I’m new to MODx and PHP but am very impressed by the combination and the system.

      I need to run an English/French site but the standards for the site specify that an English and Français button (text styled to look like a button, i.e. not a graphic) always sit above the main submenu. When you are on an English page, the English button is in red and the Français button in gray. When you are on a French page, the reverse is, of course, true. At any time you can click either button to go the page in the selected language (if it exists.)

      So setting aside the fact that I’m using text based buttons (an unordered list styled appropriately) would I have to place the Language snippet (modified to work with text based anchors rather than images) in both the English and French button and assign both an English and French country code in the Template variable (i.e. en=7,fr=11)? Futhermore, could I also use the template variable to designate the class attached to the English and French links to control their colour?
        • 33372
        • 1,611 Posts
        Personally I usually take the easy way out and just have two separate WayFinder templates (in my case one for English, one for Spanish). That way you can just put your buttons in the WayFinder outer template chunk and you don’t have to worry about any snippet logic or anything. I’m sure that you can do this with a single WayFinder call and a snippet that creates the two buttons depending upon the current language ID, but I don’t think you gain anything by doing it the harder way.
          "Things are not what they appear to be; nor are they otherwise." - Buddha

          "Well, gee, Buddha - that wasn't very helpful..." - ZAP

          Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
          • 25803 ☆ A M B ☆
          • 721 Posts
          I haven’t yet figured out everything about the WayFinder and at this point am completely confused by the documentation about how template chunks work with it but am anxious to fully understand it (and then perhaps write something up about it as I’ve written several training manuals that people have found helpful.)

          At any rate I’ve modified this Snippet here:

          Original Code:

          // get languages info
          $tv = $modx->getTemplateVar('languages', "", $modx->documentIdentifier);
          $languages = $tv['value'];


          Modified To:

          // get languages info
          $tv = $modx->getTemplateVar('LanguagesEN', "", $modx->documentIdentifier);
          $languages = $tv['value'];


          I’ve created a LanguagesEN snippet to handle the English page redirects and a LanguagesFR to handle the French redirects. I’ve also created two snippets, LanguageSwitchEnglish and LanguageSwitchFrench which are place with the anchor element of the language menu which is why I had to change the code below in the original snippet:

          Original Code:

           // seperate into lang code and target document id
            list($lang, $targetid) = explode("=", $entries[$e]);
            $image = '<img src="assets/images/'.$lang.'.gif" width="16" height="11" border="0" alt="'.$langnames[$lang].'" />';
            if (strlen($output))
            {
              $output .= ' ';
            }
            $output .= '<a href="'.$modx->makeUrl($targetid).'">'.$image.'</a>';
          }
           
          return $output;


          Modified To:

          // seperate into lang code and target document id
            list($lang, $targetid) = explode("=", $entries[$e]);
            if (strlen($output))
            {
            $output .= ' ';
            }
            $output .= $modx->makeUrl($targetid);
          }
           
          return $output;


          Now, I’ve created two Template Variables, LanguagesEN and LanguagesFR. Ideally, I’d like to associate the EN TV with the English Template and the FR TV with the French, rather than including them in both. However, I’m not sure how to program the Snippets to go the current page if the value of the TV is empty. If I could do that, then I wouldn’t have to place both TVs in both templates and set them both (I will make a generic en=x / fr=x page to go to if there is no translation.) From what I can gather this line:

          $output .= ' ';


          Is the result if it is empty and it is in there that I should be able to designate that the link (when empty) goes to the current document.
            • 2472
            • 151 Posts
            Hi all,

            I succesfully used the Redirect and Languages snippets to make a bi-lingual site ( french/dutch). Before heading to production I have one last problem to solve : the 404-like pages set in the Modx configuration settings...

            Any ideas on how to load the french 404 page or the dutch 404 page according to which lang the user was in when hitting the 404?

            TIA
              A thing of beauty is a joy forever ( John Keats)
              • 33372
              • 1,611 Posts
              I actually like having a billingual 404 page (in case someone’s arrived there based on a search term that isn’t necessarily limited to one language, such as proper nouns). But if you want to have one in each language you can either write a snippet that returns the appropriate content in each language on a single page or change the 404 page document id in a plugin. I think that you can find the code to do that in the subsite plugin in the repository.
                "Things are not what they appear to be; nor are they otherwise." - Buddha

                "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                • 18253
                • 34 Posts
                Quote from: ZAP at Sep 25, 2007, 07:21 PM

                Personally I usually take the easy way out and just have two separate WayFinder templates (in my case one for English, one for Spanish). That way you can just put your buttons in the WayFinder outer template chunk and you don’t have to worry about any snippet logic or anything. I’m sure that you can do this with a single WayFinder call and a snippet that creates the two buttons depending upon the current language ID, but I don’t think you gain anything by doing it the harder way.

                Hi everyone,

                I have been receiving some help from Susan on: http://modxcms.com/forums/index.php/topic,22407.0.html (in order to get the menu system working according to a site I did static and have decided to implement MODx so as to save time and be efficient)

                I’m in Mexico so will eventually have to go Spanish with the site www.ampisancarlos.org that is currently only in English, so I started to follow the wiki on: http://wiki.modxcms.com/index.php/Make_Multi_Lingual_Site so that I can simultaneously designate the Spanish translator to work along with me (directly on the site now with MODx).

                I successfully followed the steps and learned on the way yet I’m stumped with how the menu will change to Spanish in order to match its content.

                I have an english page at: http://www.haztufiesta.com/ampi-62.html with the Mexican flag at the top linking to its Spanish equivalent at http://www.haztufiesta.com/ampi-63.html

                How do I setup two different Wayfinder Templates as quoted above in order to have my menus change according to the language template variable? Does this apply to my situation or is their a better recommended route?
                  • 33372
                  • 1,611 Posts
                  I use two container documents (one for English and one for Spanish). Then I just mirror the content of the site in both subfolders and I use different templates with WayFinder calls for each subfolder. It’s often easiest to create the whole site in one language first and then duplicate that subfolder, since then you’ll have all of the pages that you need created and you just need to translate them (and you can use the Doc Manager module to change the templates for all the second language’s documents).
                    "Things are not what they appear to be; nor are they otherwise." - Buddha

                    "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                    Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                    • 18253
                    • 34 Posts
                    Hello Zap,

                    That is exactly what I was assuming was needed based on the wiki and forums. How exactly do I have WayFinder Calls for each subfolder? I am not sure how the system understands what subfolder relates to what WayFinder. Do you know of a post on the subject or would you mind sharing your WayFinder Calls for each subfolder so that I can try and figure out how I call a different menu?

                    After mirroring the content of the site, do you use the same method (My Solution for Scaleable Multi Language Support) with the flags to switch between languages? Any chance I can see a live site?

                    Thanks

                    Marco
                      • 18253
                      • 34 Posts
                      Hello Zap,

                      Wow, I’m amazed by the minute with MODx. It was easier than expected figuring out that creating another Wayfinder (which is in essence a snippet) simply involved clicking duplicate and naming it something like WayfinderEsp . (thanks to the help of http://wiki.modxcms.com/index.php/Wayfinder)

                      After creating the new snippet, WayfinderEsp, I then proceeded to create Duplicate Templates and just renamed them template_nameEsp.

                      After that, I simply went in to the new template and added Esp to the Wayfinder call...
                      From this,
                      [!Wayfinder?startId=`0` &hereClass=`current` &level=`1` &outerClass=`topnav`!]
                      To this,
                      [!WayfinderEsp?startId=`0` &hereClass=`current` &level=`1` &outerClass=`topnav`!]

                      You have to remember to go back to each of the Spanish (Esp) pages you duplicated and simply as ZAP mentioned:

                      (and you can use the Doc Manager module to change the templates for all the second language’s documents).

                      My hats off to all the MODx team. This Framework is AWESOME !!!

                      The other site, I’m also planning on converting to MODx (www.grupocaballero.com), can already boast this testing change at:

                      (English page with English left Menu, http://www.expresionestv.com/index.php?id=2 with Mexican Flag linking to
                      (Spanish page with Spanish left Menu, http://www.expresionestv.com/index.php?id=5 with US Flag linking back. (all I would have to do to finish up the Spanish template is update header and footers with spanish text and image translations)