We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46886
    • 1,154 Posts
    should web culture key just be web or it doesnt matter? I guess in the example its english as the web language and he has it as en...

    I do think your base url...should have the /nua/ in them?

    Ok also I am going over your pictures, and I notice your switcher code has a bit of an issue (I am not a coder myself)


    <?php
    if($modx->context->get('key') != "mgr"){
        /* grab the current langauge from the cultureKey request var */
        switch ($_REQUEST['cultureKey']) {
            case 'en':
            //switch the context
              $modx->switchContext('english');
              break;
            default:
              // Set the default language/context here
              $modx->switchContext('web');
              break;
            }
                /* unset GET var to avoid appending cultureKey=xy to URLs by other components */
                unset($_GET['cultureKey']);
      }


    This looks very much like you are defining the mgr view...I could be wrong but does this switcher apply to mgr side of Modx...

    its this line that makes me wonder, the rest looks fine. But I can't read it at a level to know for sure.

    if($modx->context->get('key') != [b]"mgr"[/b]){
      • 51265
      • 32 Posts
      Okay. I'll get onto my hosting provider now. Was talking to Menno about it. He went through my code but saw nothing wrong. He suggested I try Modx XRouting instead.

      He went through mode code from start to finish and saw nothing wrong. He was puzzled. [ed. note: colin1981 last edited this post 5 years, 5 months ago.]
        • 46886
        • 1,154 Posts
        Ok talk to them. Its possible we will have to move onto a different system for your menus, its obviously a pain but not all that tough.

        Also check with the one babel call pulled out, and then with both...maybe try with the other one as well.

        If we know its babel its perhaps easier to work with another tool, there are lots of them and they aren't hard to set up.
          • 46886
          • 1,154 Posts
          I came across this thread recently as well, it could be relevant. This guy has specific pages which wouldn't work, due to alias issues

          Unfortunately the only solution seems to be that x-router package, and the user didn't report back...

          but it might help us explain what is going on. Did you try making a new page with different alias for the home page, just to see? Or you could just change the home page alias

          https://forums.modx.com/thread/102495/babel-alias-with-culture-key-in-url
            • 3749
            • 24,544 Posts
            Quote from: nuan88 at Nov 19, 2018, 03:45 PM
            should web culture key just be web or it doesnt matter? I guess in the example its english as the web language and he has it as en...

            I do think your base url...should have the /nua/ in them?

            Ok also I am going over your pictures, and I notice your switcher code has a bit of an issue (I am not a coder myself)


            <!--?php
            if($modx--->context->get('key') != "mgr"){
                /* grab the current langauge from the cultureKey request var */
                switch ($_REQUEST['cultureKey']) {
                    case 'en':
                    //switch the context
                      $modx->switchContext('english');
                      break;
                    default:
                      // Set the default language/context here
                      $modx->switchContext('web');
                      break;
                    }
                        /* unset GET var to avoid appending cultureKey=xy to URLs by other components */
                        unset($_GET['cultureKey']);
              }


            This looks very much like you are defining the mgr view...I could be wrong but does this switcher apply to mgr side of Modx...

            its this line that makes me wonder, the rest looks fine. But I can't read it at a level to know for sure.

            if($modx->context->get('key') != [b]"mgr"[/b]){

            That's definitely wrong unless you've added the bold tags. If it really says != "mgr" it's very likely correct as the code below it would only execute in front-end contexts, which makes sense for a multi-context site.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 46886
              • 1,154 Posts
              Hi BobRay, I was flagging anything that looked possibly off, you are right that mgr isn't a problem.

              With this users site, right now, it seems only the en/ home page isn't working, everything else seems to work.

              Could this be a problem with alias? Its only the home page for the en context I believe that isn't working
                • 46886
                • 1,154 Posts
                Testing right now, every single en page seems fine...expect for the home page (with no alias)

                The page isn’t redirecting properly

                Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

                This problem can sometimes be caused by disabling or refusing to accept cookies.

                http://www.gaeltaca.ie/nua/en/
                  • 46886
                  • 1,154 Posts
                  Ok so @colin1981 please check the context settings for home page, and I do think an alias for the home page would be helpful, even 'home' but better yet something unique. Is it now 'en'? I don't think it should be.

                  Also you can try to use the dev tools when loading the page to see these redirects, I will check that out but not sure if i can see anything.

                  I think the general strategy is to go around the problem, that's my angle anyway. A fix is a fix.
                  • Hello, thank you for using Babel, and of course MODX for your project.

                    I'd like to help you, since this issue always makes pain in the a$$ for most of newbies.
                    The problem gets more complicated after copy-pasting all different codes from all places the google lands them. Thus, I'll try to explain the internal work without sharing any code.


                    1. MODX detects language by using "cultureKey" value in $_REQUEST, $_SESSION, or the default option in System Settings (which can be overridden by Context Settings)

                    2. That's why in page load, .htaccess tries to redirect the page to another URL, just to give an identifier about which "cultureKey" it should be using.

                    3. Then Plugin (gateway for some said), captures that "cultureKey", then tries to load the related "context_key" to render the page content, which should have base_url or site_url setting that adds prefix the URL.

                    4. Well, you can add more required Context Settings, like: cultureKey, base_url, site_url, start_page, error_page, unauthorized_page, default_template, etc, which are always different to the other context(s).

                    Many users like to confuse between those settings, just keep this in mind: "cultureKey" ≠ "context_key".
                    You can have have multiple cultureKeys with one context_key (Lingua), or multiple context_keys with only 1 (one) cultureKey.

                    I believe your kind of problem was a redirect loop because htaccess forwards (or does not forward) the page to a URL, then the Plugin forwards (or misses the identifier so repels) it back to another galaxy. Thus, you trapped in time loop. ;p

                    So, actually what you need to do, is to read the combination codes between htaccess and any Plugin (or gateway, which gets more options from the Context Settings), and make them talk each other nicely.

                    I hope this helps.
                      Rico
                      Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                      MODx is great, but knowing how to use it well makes it perfect!

                      www.virtudraft.com

                      Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                      Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                      Maintainter/contributor of Babel

                      Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
                      • 51265
                      • 32 Posts
                      Hi guys,

                      It took a while for the hosting providers to get back to me as I had to go through the client. It turns out there was no errors coming up which I find strange. I feel the client just didn't understand the situation and couldn't explain it to me after talking to the providers.

                      A fellow Modx Revo user asked me to try take the code out of the sub folder and put in the root to see would it fix the issue and it seemed to work. All pages are loading now. Could it possible be the sub folder?

                      In regards the home pages. My Irish Homepage is /baile.html and my English Homepage is /home.html. [ed. note: colin1981 last edited this post 5 years, 5 months ago.]