We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1764
    • 680 Posts
    This is great news. A faster and more powerful parser. Thanks for all your hard work on this Remon.
      • 32963
      • 1,732 Posts
      Cool! That’s looking good so far.

      The good news is that it’s a little faster and also supports recursive parsing smiley

      Can you say how many snippets where processed?



        xWisdom
        www.xwisdomhtml.com
        The fear of the Lord is the beginning of wisdom:
        MODx Co-Founder - Create and do more with less.
        • 32963
        • 1,732 Posts
        It might also be good to add some debug code to show number of tags parsed and execution order. This only occurs when debug is enabled
          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
          Sure, I’ll add some debugging stuff, at least, I’ll try to do so smiley

          I would call the speed increase rather significant, since it’s just comming from the parser’s find and replace snippets/chunck/etc routines!

          Ehm, the home page of the modx install has a:
          - DropMenu
          - FlexSearchForm
          - ListRelated
          - Most Recent

          Which add significant to the processing time! (the evaluating of those snippets I mean)

          Also a number of [(yada)] and [*yada*] which is handled by the processTags funtion now too, but these don’t add much to the processing time.

          Some parts of the processTags() can be unified/simplified if the calling convention would be like this:

          [[T CODE ]]
          


          Where T is a specific tag, and CODE the name of a snippet/chunk/etc with additional parameters(only for snippets).

          So, this:
          [*#content*]
          


          will become this:
          [[*#content]]
          


          A snippet remains the same, a chunk would be:
          [[{chunkname]]
          


          A placeholder:
          [[+placeholdername]]
          


          So in processTags we check for first occurences of:
          [[*
          [[(
          [[+
          etc
          [[

          on a match, we substring the template until a ’]]’ is found, and feed that to the correct method.
          and continue our recursive processTags();
          In case of a snippet, the snippet parsing code checks for nested snippets, just like it is now.

          What do you think?

          Greetz,

          Remon
            • 34162
            • 1 Posts
            Very nice and very logical!

            Good work!
              • 32963
              • 1,732 Posts
              Hi Remon,

              You’re right on target. We have been discussing the very same thing over the past few days. I’ll soon post those new tags here for us to review.

                xWisdom
                www.xwisdomhtml.com
                The fear of the Lord is the beginning of wisdom:
                MODx Co-Founder - Create and do more with less.
                • 32963
                • 1,732 Posts
                I would also suggest that we can go ahead and implement the once you have suggested:

                [[*
                [[(
                [[+
                etc
                [[

                And we can later fine tune the tags to match the new recommendations.

                  xWisdom
                  www.xwisdomhtml.com
                  The fear of the Lord is the beginning of wisdom:
                  MODx Co-Founder - Create and do more with less.
                  • 32963
                  • 1,732 Posts

                  Note: This part (line 727) of the parser only collects the arguments passed into the system e.g. [[Snippet? &param1=`value`]]

                  $snippetProperties = '';
                  if($et>$st) {
                  	$tag = substr($source,$st+2,$et-$st-2);	// get params
                  	$parameterpos = strpos($tag,'?',0);
                  	if ($parameterpos) {
                  		$snippetname = substr($tag, 0, $parameterpos);
                  		$snippetProperties = substr($tag, $parameterpos, $et-$st-2);
                  	}
                  	else {
                  		$snippetname = $tag;
                  	}
                  



                  // HELP HELP HELP
                  // EEHHMMMM, can someone explain me why we have a parseProperties function called above, and then
                  // do (ALMOST) the exact same stuff again below, overwriting the values assigned in parseProperties?????

                  the parseProperties() function is works on the parameters assigned from within the manager (default params). We then merge the parameters entered by the user as shown above in an effort to allow a developer to override the default params.
                    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
                    Wow... I go away for a few hours and great things happen... think I’ll do that more often! laugh

                    Thanks Remon/Raymond!
                      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: rthrash at Nov 15, 2005, 03:21 PM

                      Wow... I go away for a few hours and great things happen... think I’ll do that more often! laugh

                      Thanks Remon/Raymond!

                      Hehe, you write if different, but pronounce it (almost?) the same ;-)

                      After some headaches (oh, I had one allready, never mind) again a new version of the parser, now with:

                      [[*yada]]
                      [[(yada]]
                      etc.

                      calls, for those interested, I could provide an url to show it works, and oh why not just giving it, here it is:
                      http://vt.shuis.tudelft.nl/~remon/test/

                      Have funn!

                      Remon

                      (P.S. I suppose there are a number of bugs left, but thats also part of the fun, no?
                      For example, friendly urls have a problem somehow)