We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14883 ☆ A M B ☆
    • 450 Posts
    I have a snippet called checkLeftColumn, which checks some TV values and also determines whether to run a Wayfinder call to show a left column navigation menu. My current configuration is:

    Here's what I'm seeing in the error log when I load a resource that uses this template:

    [2013-08-13 15:54:10] (ERROR @ /index.php) modSnippet: checkLeftColumn executed in 0.2841 s
    [2013-08-13 15:54:10] (ERROR @ /index.php) modSnippet: checkLeftColumn executed in 0.2127 s
    [2013-08-13 15:54:10] (ERROR @ /index.php) modChunk: ohrwd_template executed in 1.0739 s


    I'm not calling the snippet twice. And I don't think it is doing any crazy recursive stuff. (Even if it was, it wouldn't be calling Executioner and showing up in the logs that way, right?).

    Just for fun I put another Executioner call further down in my html chunk, to see if that was being parsed twice also. It isn't.
    [2013-08-13 15:54:10] (ERROR @ /index.php) modSnippet: checkLeftColumn executed in 0.2841 s
    [2013-08-13 15:54:10] (ERROR @ /index.php) modSnippet: getSite executed in 0.1306 s
    [2013-08-13 15:54:10] (ERROR @ /index.php) modSnippet: checkLeftColumn executed in 0.2127 s
    [2013-08-13 15:54:10] (ERROR @ /index.php) modChunk: ohrwd_template executed in 1.0739 s


    So it isn't happening with *all* calls. Just this particular one.

    Any clue what's going on here?

    This question has been answered by jrotering. See the first response.

    • discuss.answer
      • 14883 ☆ A M B ☆
      • 450 Posts
      I figured it out.

      My Executioner call looked like this:
      [[!Executioner? &tElement=`checkLeftColumn`&site=`[[+site]]`]]


      For whatever reason, the cached placeholder was causing the snippet to get parsed twice. When I change it to an uncached placeholder, the snippet only gets parsed once. Same if I remove the &site argument entirely.

      This has been another episode of "James talks to himself on the forums." [ed. note: jrotering last edited this post 13 years, 1 month ago.]
        • 22303 MODX Staff
        • 10,725 Posts
        The whatever reason is that only unique tags get parsed. If two tags exist on a page with exactly the same tag signature (tag string plus all properties from property sets), only the first instance is parsed and the output replaces all instances of that tag.
          • 14883 ☆ A M B ☆
          • 450 Posts
          Quote from: opengeek at Aug 13, 2013, 06:15 PM
          The whatever reason is that only unique tags get parsed. If two tags exist on a page with exactly the same tag signature (tag string plus all properties from property sets), only the first instance is parsed and the output replaces all instances of that tag.

          I'm not sure I understand what you mean in terms of my issue. Is it because I had '[[+site]]' listed more than once on my page? I'm really confused. I do know that my solution (calling the placeholder uncached) solves the issue. I'm just not following your explanation.
            • 22303 MODX Staff
            • 10,725 Posts
            Maybe I didn't completely understand the issue. What is setting the site placeholder?
              • 14883 ☆ A M B ☆
              • 450 Posts
              Quote from: opengeek at Aug 16, 2013, 05:16 PM
              Maybe I didn't completely understand the issue. What is setting the site placeholder?

              The placeholder is just a property of the chunk that contains this snippet call. The flow was

              • Template w/ uncached Executioner call of chunk
              • chunk contains uncached Executioner of snippet, with cached placeholder being passed to it

              That was rendering the snippet twice. But when I switched the placeholder to uncached, Executioner only rendered the snippet once.
                • 3749
                • 24,544 Posts
                It sounds like you have a snippet tag in your Template that pulls in a chunk containing a tag for the same snippet. Why wouldn't you expect the snippet to execute twice? I think we're all confused now. wink
                  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
                  • 14883 ☆ A M B ☆
                  • 450 Posts
                  No, the snippet tag is only in the chunk. And the template only calls the chunk. Just once. It doesn't call the snippet separately.

                  And the snippet only fires twice if the placeholder being passed to it is cached. Not when the placeholder is uncached.

                  Hope that clears things up.
                    • 3749
                    • 24,544 Posts
                    OK, I get it now, though how it could happen is still a mystery to me.
                      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
                      • 37619
                      • 79 Posts
                      Quote from: jrotering at Aug 13, 2013, 09:08 PM
                      This has been another episode of "James talks to himself on the forums."
                      Hilarious lol.

                      This is also happening for me. My snippet [[!snippet? &get=`test`]] is being called twice (it's logging twice in a row in the error log), even though I'm only calling it once. Has anyone figured out why this is happening? My guess is there's something funky with the MODX Cloud caching (maybe?).

                      Any help would be appreciated. Thank you.
                        Jean-Marc Buytaert (@jmbuytaert)

                        MODX truly is the greatest thing that's ever happened to the Internet.