We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    Well, it's getting late here, so I'll go back into it and see what happens in the morning.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Well, here's what works for the gallery:

      [![!setAlbumJs]]
      <section id="album">
      <figure class="cycle-slideshow" 
          data-cycle-fx=fade
          data-cycle-timeout=4000
          data-cycle-caption="#alt-caption"
          data-cycle-caption-template="{{alt}}"
          >
      [![!getImageList? &tvname=`album` &tpl=`albumTpl`]]
      </figure>
      <h2 id="alt-caption" class="center"></h2>
      </section>

      Any other combination of cache directives either does not load the javascript, or does not maintain the cultureKey for the image captions.

      However, this configuration now prevents the cultureKey from changing for page content, it gets stuck on the first one accessed after the cache is cleared...although the pdoMenu snippet still works.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        It turns out that any chunk in the content was causing problems. So I created a new template and put the [[$album]] chunk in the template. That also eliminated the setAlbumJS problem, since the gallery template has the css and js in the template.

        But the getImageList snippet still has to be double-uncached for the cultureKey to be used.
        [![!getImageList? &tvname=`album` &tpl=`albumTpl`]]
        


        Ah. If I call the album chunk uncached [[!$album]] then I can get away with calling the getImageList snippet uncached [[!getImageList]]

        What a riot!

        I cheated! I added these two output modifiers to my regular template:
        [[[[*id:is=`6`:then=`!setAlbumJs`]]]]
        [[[[*id:is=`6`:then=`!$album`]]]]
        


        Now all works beautifully with a single template. Well, it sets the javascript once for each language, then after that it doesn't set it at all. <sigh> Oh, well. [ed. note: sottwell last edited this post 12 years, 3 months ago.]
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 36549
          • 572 Posts
          I've got an issue with the home pages for each language (www.mySite.com/en and www.mySite.com/we) displaying the unauthorised page.
          A members area we set up was generating a 404 for non-logged in users and going to the error_page, on this site we've changed it so that we don't display the error page we just call the unauthorized_page instead, but the www.mySite.com/en and www.mySite.com/we links are actually generating a 404, not a 401 unauth code.
          Any ideas how to fix this?
            www.9thwave.co.uk
               WEB | DESIGN | PRINT
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            The anonymous user has to have at least load privileges for your protected resource group, otherwise they won't even be able to tell that they exist, thus getting the error page instead of the unauthorized page.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 36549
              • 572 Posts
              Thanks for your input Sottwell, unfortunately there is still an issue.
              The developer i'm working with thought he wasn't getting the perms right but now thinks it might be something to do with the language stuff behind the scenes.
              When I click a link to a protected page in the default language i get a 503 but when i select another language and click on the protected page link i get directed to the home page, surely they should do the same.
                www.9thwave.co.uk
                   WEB | DESIGN | PRINT
                • 4172
                • 5,888 Posts
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Make sure you're testing protected pages when you're not logged in to the Manager (or use a different browser) - being logged in to the manager can cause unexpected results when testing protected pages.

                  That 503 error means that the request never got to MODX. What does your .htaccess file look like?
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    This must be answered somewhere but I can't find it. How would I display the current language, the whole language string, like "English" or "Deutsch", not the cultureKey.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 4172
                      • 5,888 Posts
                      I think there wasn't anything.

                      this snippet 'mmlCurrentLanguage' should do it:

                      $cultureKey = $modx->getOption('cultureKey');
                      $packageName = 'migxmultilang';
                      
                      $packagepath = $modx->getOption('core_path') . 'components/' . $packageName . '/';
                      $modelpath = $packagepath . 'model/';
                      if (is_dir($modelpath)) {
                          $modx->addPackage($packageName, $modelpath, $prefix);
                      }
                      $classname = 'mmlLang';
                      
                      $output = '';
                      
                      if ($object = $modx->getObject($classname,array('lang_key'=>$cultureKey))){
                          $output = $object->get('language');
                      }
                      
                      return $output;
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!