We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 54972
    • 8 Posts
    tomgwarrior Reply #1, 5 years ago
    Hello.
    I dont know when it started but at some point i realised that when i add "!" to make snippet or chunk non cacheable, the code after "!" is outputted as plain text on certain html page.

    For example: [[&form_request?]] works fine.
    [[!&form_request?]] doesnt work.
    I just get text: [[!&form_request?]] in a place of element on web page

    I've attached screenshot.

    Site located on shared hosting so i havent changed any server side parameters.
    I also tried to reinstall modx as an update.

      • 3749
      • 24,544 Posts
      The ampersand (&) is only used to identify properties in a tag. If you put it in front of the snippet or chunk name you'll only confuse the parser, which thinks it's not a MODX tag and just outputs it as straight text.

      Snippet Tags:

      [[SnippetName? &some_property=`some value`]]
      [[!SnippetName]]
      

      Chunk Tags

      [[ChunkName]]
      [[!ChunkName]]
        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
        • 54972
        • 8 Posts
        tomgwarrior Reply #3, 5 years ago
        Thanks for the reply BobRay.

        Sorry I've mistaken due to late time. Of course i do not use ampersand at element call.

        For example i call a simple snippet

        [[!QuickEmail? &to=`[email protected]`&debug=`1`]]

        And it outputs as plain text.

        But [[QuickEmail? &to=`[email protected]`&debug=`1`]] working correct.

        Same with chunks. But when i call a snippet at document type XML (sitemap), it works fine with an exclamation mark.

        here is example page:

        https://expert-ops.ru/mailtest

        a sitemap call works fine:

        [[!pdoSitemap?
        &resources=`-8`
        ]]

        https://expert-ops.ru/sitemap.xml [ed. note: tomgwarrior last edited this post 5 years ago.]
          • 38783
          • 571 Posts
          On your first example I am seeing the following on the front end

          CALLING SNIPPET WITH EXCLAMATION: [[!QuickEmail? &to=`[email protected]`&debug=`1`]] 
          
          CALLING WITHOUT EXCLAMATION: Unauthorized


          So when uncached I am getting just the word: Unauthorized

          It might be worth checking the permissions on your files and folders.
            If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

            email: [email protected] | website: https://andytough.com
            • 38783
            • 571 Posts
            I have just noticed what snippet you are using. The word 'Unauthorized' is probably the correct response for that snippet.
              If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

              email: [email protected] | website: https://andytough.com
              • 3749
              • 24,544 Posts
              I did see what you mean with one of your examples. Do you happen to happen to have the FastField extra installed?



                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
                • 54972
                • 8 Posts
                tomgwarrior Reply #7, 5 years ago
                Quote from: BobRay at Mar 25, 2019, 02:59 PM
                I did see what you mean with one of your examples. Do you happen to happen to have the FastField extra installed?


                No, i am very new to modx so i used few of extras.
                they are:

                Ace

                Canonical

                FormIt

                pdoTools

                QuickEmail

                Wayfinder

                googlesitemap -- deleted

                ---
                pdoTools i've installed just yesterday, i thought it has own parser who will work correctly smiley But was surprised it has great sitemap.

                My install is clean, what i did is just transferred it from subdomain to main domain by moving folders and changing paths in configuration files.

                In my tries to fix the issue i even made an installation of modx over my installation as an update.
                I've checked all configuration files, htaccess etc...

                Also why parser interpretate xml document correct and html not ?

                It is not critical to me at the moment as i am not expiriencing problems caused by caching, but i cant get FormIt working smiley
                Even simplest 'redirect' hook. So i started to think this is because i forced to call FormIt without exclamation mark.

                Focusing on the topic, also i tried to deinstall ace and almost every extra except wayfinder i guess.




                Quote from: andytough at Mar 25, 2019, 01:15 PM
                I have just noticed what snippet you are using. The word 'Unauthorized' is probably the correct response for that snippet.

                I think 'unauthorised' is correct output for non-admin user. It shows the snippet call was parsed correctly.
                  • 3749
                  • 24,544 Posts
                  I found this in the source code of your mail test:

                  <!-- /Yandex.Metrika counter -->


                  It's possible that its JavaScript is interfering with the parsing of MODX tags, though it seems unlikely.

                  What version of MODX are you using?

                  What happened when you tried to upgrade MODX (and what was your upgrade method)?

                    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
                    • 54972
                    • 8 Posts
                    tomgwarrior Reply #9, 5 years ago
                    Quote from: BobRay at Mar 25, 2019, 05:42 PM
                    I found this in the source code of your mail test:

                    <!-- /Yandex.Metrika counter -->


                    It's possible that its JavaScript is interfering with the parsing of MODX tags, though it seems unlikely.

                    What version of MODX are you using?

                    What happened when you tried to upgrade MODX (and what was your upgrade method)?


                    Well i thought about javascript. Will try to comment scripts 1 by 1. Yandex metrika is russian web analytics similar to google analytics. Used on almost every site, but i could not find similar problem in russian segment of web. tbh i found 1 guy but he was unable to solve it.

                    I've changed template of 'mailtest' page to default, without fancy JS and nothing changed.

                    I am using 2.7.1-pl.

                    Well it was not really an upgrade, because i just downloaded setup of same version. I ran it and installation offered me to perform an update with saving all my settings. All was performed flawless.

                    But problem gone nowhere.

                      • 3749
                      • 24,544 Posts
                      Since nothing else has worked, here's what I'd suggest:

                      1. Install the UpgradeMODX extra in Package Manager.

                      2. Set your settings_version System Setting to 2.6.5-pl

                      3. Use UpgradeMODX on the main dashboard (click on the MODX logo) to "upgrade" to 2.7.0, then another upgrade to 2.7.1 (also using UGM).

                      That will give you fresh versions of all MODX files, plus any DB updates you might have missed in 2.7.0, and it will clear the cache files.


                        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