We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29677
    • 5 Posts
    ________________________________________
    solved: my problem was cookie mistake.
    ________________________________________



    Hi

    I’m doing a multilingual site with modx

    for know language I declare var $GLOBALS[’Language’] in snippet at header

    page uses lot of snippets and chunks (news, products, articles, ... made by me)

    but now the problem is:

    - I cannot call all my snippets uncached ([!...!]) because modx gives errors

    - If I call snippet cached then it ignores language value from $GLOBALS


    I’m going crazy because I have been fighting with these features 48 hours ago

    I think it’s impossible to be so difficult! please any help will be appreciated

    thanks

    regards

      • 10076
      • 1,024 Posts
      did you check yams?

      http://modxcms.com/extras/package/543 Works fine with chunks TV s and Snippets.
      • What errors?

        Have you looked into YAMS?

        Or this simpler method?
          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
          • 15001
          • 697 Posts
          - I cannot call all my snippets uncached ([!...!]) because modx gives errors

          - If I call snippet cached then it ignores language value from $GLOBALS

          My two pennies worth:

          If you have snippets called from snippet chunks, check that you alternate brackets types (cached and uncached). After that, if you still get problems, maybe try to inverse the cached/uncached status of your snippet calls. Make the one cached uncached and vice versa.

          Does the problem remain?
            • 29677
            • 5 Posts
            hello again, 1st thanks for your quick answers!

            I don’t want to use YAMS and don’t want to use other multilingual solutions
            i’m doing my own one because I want more control

            I’m declaring global variable "Language" -> $GLOBALS[’language’] that could value "es" or "en"

            then along all my template I use this function

            [!playlanguage? $en=´hello´ &es=´hola´!]


            playlanguage function:
            $result = $en;
            if( $GLOBALS["Language"] == "es" ){
              $result= $es;
            }
            return $result;
            



            it’s very easy concept! it’s not advanced programming technique smiley

            but along template I have to make multiple calls, someones inside other snippets and chunks nested

            but it’s impossible because when you combine some calls it’s doing strange results, I have
            some parts of page in spanish and others (that are cached) in english!

            I have tried to combine different ! and [ but cannot solve it

            and my question ... why to combine calls???? it’s impossible to fully disable cache and work with global vars?

            thanks in advance

            regards

              • 29677
              • 5 Posts
              Quote from: Jul at Jun 23, 2010, 09:02 AM

              - I cannot call all my snippets uncached ([!...!]) because modx gives errors

              - If I call snippet cached then it ignores language value from $GLOBALS

              My two pennies worth:

              If you have snippets called from snippet chunks, check that you alternate brackets types (cached and uncached). After that, if you still get problems, maybe try to inverse the cached/uncached status of your snippet calls. Make the one cached uncached and vice versa.

              Does the problem remain?

              not, but thanks... not ressult sad

                • 10076
                • 1,024 Posts
                could you write what you use? and off course where the error was?
                  • 15001
                  • 697 Posts

                  Did you try $_GLOBALS instead of $GLOBAL? (Observe the underscore.)

                  If this still does not work, check if your sub-documents are cached.
                  As you’re using many snippets, maybe they use some old content.
                  Using unached (sub-)documents is also necessary if you’re using Ajax.

                  If any jQuery Javascript code is used to perform ajax requests, also make sure that $.ajax() is used and not $.post(). $.post() is a shortcut for $.ajax(), but it caches the content. If using $.ajax(), you must explicitely set the output as uncached.

                  Lastly how deep are your snippets nested?

                  I myself had issues when nesting Ditto several times to display Datagrid widgets in children documents.

                  The problem was maybe browser-specific, as I observed differences between browsers.
                  Probably because its caching technology, Opera was able to build the pages correctly.
                  With MSIE and Firefox, I had to access the sub-documents one after each other so they were cached. Afterwards, I could load the composite page with more success. But I was still obliged to make several "refresh" before all was loaded.