We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24253
    • 125 Posts
    Hehe, thanks for summarizing ;-)

    http://modxcms.com/forums/index.php/topic,1418.msg9398.html#msg9398

    (Why can’t I just say what I want to say! It takes me way to much words to explain something :-( )

    Remon
      • 1764
      • 680 Posts
      Quote from: R.S. at Nov 16, 2005, 07:37 AM

      Hehe, thanks for summarizing ;-)

      I guess I should have finished reading all of the new topics before replying, oh well.
        • 32963
        • 1,732 Posts
        I think there’s a minor bug with the recursive parser.

        It would appear that it’s will parser placeholder during execution. This should not be the case as placeholder should be should be merged with the document after parsing.

        Note:

        [[+mycontent]]
        [[SnippetA]]

        In the above SnippetA sets the mycontent placeholder value to "Hello world"
          xWisdom
          www.xwisdomhtml.com
          The fear of the Lord is the beginning of wisdom:
          MODx Co-Founder - Create and do more with less.
          • 25663 MODX Staff
          • 12,272 Posts
          Intriguiging... perhaps we should in fact maintain a separate syntax for placeholders then.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 24253
            • 125 Posts
            Quote from: xwisdom at Nov 17, 2005, 09:22 AM

            I think there’s a minor bug with the recursive parser.

            It would appear that it’s will parser placeholder during execution. This should not be the case as placeholder should be should be merged with the document after parsing.

            Ehm, yes thats right. I’m not exactly sure how placeholders are supposed to work.
            But it shouldn’t be hard to restore the orinial behaviour, though, I wonder what the difference is with the "old" parser.

            The previous way, the placeHolders were merged after the snippet, but this was done in a loop. So if the loop was taken multiple times, placeHolders were merged multipletimes too.

            Of course, we can add an extra parseTags() call in outputContent() with a modifier that [[+ ]] have to be processed this time....

            But it all depends a bit on how it is supposed to work. If a snippet has to be executed first, and then the placeholders being merged, that should somehow be possible in the same parseTags() run...

            Remon
              • 25663 MODX Staff
              • 12,272 Posts
              placholders are just that... placeholders that tell you where to put the ultimate content... a layout tool. snippets need to be run first.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 24253
                • 125 Posts
                OK, so if we make it more consistent, a snippet call is just like any other call no?

                What about calling a snippet like:

                [[@MySnippet? Yada='hi']]
                


                Then in the parser, we can do this:

                case '[[@': $this->newMergeSnippetContent($source, $startTag, $endTag);
                  break;
                case '[[+': $this->mergePlaceholderContent($source, $callCode);
                  break;
                


                :-)

                (And it actually works smiley )
                  • 25663 MODX Staff
                  • 12,272 Posts
                  or we could have it just defalut as the last option to process as a snippet... although bad syntax might slip through to ill connsequences...
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                    • 32963
                    • 1,732 Posts
                    Hi Remon,

                    The above would only work if the placeholder was positioned below the snippet:

                    [[@MySnippet? Yada=’hi’]]
                    [[+MyPlaceholder]]

                    The problem exists if the placeholder is positioned above the snippet

                    [[+MyPlaceholder]]
                    [[@MySnippet? Yada=’hi’]]

                    The parser would then process [[+ first followed by the [[@.

                    I think the solution is to find and replace all placeholders at the end of the parser. This means that during the parser pass placeholders are collected and stored inside an array but not replaced. at the end of the parse loop they are then replaced.


                      xWisdom
                      www.xwisdomhtml.com
                      The fear of the Lord is the beginning of wisdom:
                      MODx Co-Founder - Create and do more with less.
                      • 24253
                      • 125 Posts
                      Ah, ok.

                      Well, to keep it simple, we just run the parser again after it parsed the whole document!
                      (And only then process the [[+ ]] tags)

                      :-)