We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8439
    • 89 Posts
    Just to try and make my code clearer to read, I split up a snippet call so it looked like:
    [!eForm?<br />&foo=`bar`<br />&baz=`something else`<br />...<br />!]
    and it didn’t work.

    Surely it can’t be that hard to parse snippet etc calls so that arbitrary whitespace (including end of line comments) separate the arguments?

    Point me at the appropriate bit of code and I’ll see if I can produce a patch

    Ed
      • 30223
      • 1,010 Posts
      Not only pointing you in the right direction, but a possible simple solution...

      document.parser.class.inc.php line 720 (or there abouts) change:

      <?php
      preg_match_all('~\[\[(.*?)\]\]~', $documentSource, $matches);
      ?>

      to
      <?php
       preg_match_all('~\[\[(.*?)\]\]~s', $documentSource, $matches);
      ?>


      All this does is that it makes the . (dot) in the regular expression match newlines as well.

      Mind you I only very briefly tested this with one snippet and I didn’t verify what could happen further down in the code. It’s by no means a final solution. However it should be a small job of cleaning out any newline characters.
        • 6437
        • 157 Posts
        Hi all

        Being a ModX AND php n00b I would like to add a little weight to this point and request that it becomes a standard change within the ModX core if possible?

        As a programming/ModX novice i feel that this would make snippet calls far more accessible and readable. With some snippets taking many many arguments now, it appears a logical feature.

        Cheers,

        Steve
          • 8439
          • 89 Posts
          Quote from: TobyL at Oct 04, 2006, 07:21 AM

          Not only pointing you in the right direction, but a possible simple solution...
          <?php
           preg_match_all('~\[\[(.*?)\]\]~s', $documentSource, $matches);
          ?>

          Another solution might be
          <?php
           preg_match_all('~\[\[(.*?)\]\]~', preg_replace('[\n]', " ", $documentSource), $matches);
          ?>
          Which changes newlines to spaces leaving the existing code as it is. Warning I’ve only tried this using php -a but it seems to work, one could also add \r, \t etc

          EDIT: what would the effect of these fixes be on newlines within argument values, e,g, &arg=`text\nmore text`

          If it’s safe please can we get this into svn?
          Ed
            • 6726
            • 7,075 Posts
            Don’t bother too much with this... unless it’s high priority (in which case, maybe Raymond could point you in the right direction).
            I know it won’t solve it for you but the future parser of MODx (still in testing) is already able to do that smiley

              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l&#39;outil id
              • 8439
              • 89 Posts
              Quote from: davidm at Oct 04, 2006, 08:10 AM

              Don’t bother too much with this... unless it’s high priority (in which case, maybe Raymond could point you in the right direction).
              I know it won’t solve it for you but the future parser of MODx (still in testing) is already able to do that smiley
              Certainly not a high priority for me. It’s not going to be in 0.9.5 presumably but a rough ETA?

              Ed
                • 6726
                • 7,075 Posts
                No it won’t be in 0.9.5.

                Always hard to give an ETA, the release after 0.9.5 wouldn’t be far fetched, but for such major change as a new parser you never know how long tuning will take, especially since it also involves modifying MODx caching mechanism... I can’t really answer this, but in the not-so-long distant future wouldn’t be preposterous either...


                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l&#39;outil id
                  • 727
                  • 502 Posts
                  I’ve seen numerous times an ETA given for collaborative open-source projects and then see people hang on waiting and waiting and the code is finally released months later than expected. This discourages developers from giving an ETA, and rightly so. However in the absence of an ETA I would make the assumption that the post 0.9.5 release is going to be many, many months away.

                  This seems like such a simple change, plus lots of effort is currently going into 0.9.5, so that implies to me that 1.0 is a long way off yet, otherwise why would OpenGeek, rthrash, xwisdom, etc. bother and just skip it instead?

                  Andy
                    • 25663 MODX Staff
                    • 12,272 Posts
                    Why would you make that assumption Andy? tongue

                    095 is locked down feature wise. Only updates to demo content and bugfixes are going in. There is no reason why a significant upgrade to the parser or other additional features couldn’t make it into a path release or even a (not planned but entirely possible based on some cool things that happened today) 096. There’s lots of innovative and ongoing work taking place even as I type this.

                    095 really is providing us a solid platform from which you’ll see even better things come about in a hopefully much more consistent manner. I’d also expect to see more frequent patch/bug releases in the future (e.g., 0.9.5.1, 0.9.5.2, etc as needed).
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 6726
                      • 7,075 Posts
                      Well, Ryan said what I wouldn’t dare say... I understand your reaction, Andy. This being said, the MODx team is one bunch of enthusiasts quite excited about the project : in the past, we have given some ETA or infos which we have been unable to make happen and people got disappointed (intially, the new parser was due for 0.9.5...).

                      We might have tuned down our enthusiasm (at least, the way we communicate about it) to take this into account. But don’t be mistaken, we are still running like a freight train ! This is not any open source project here wink You shall see cool
                        .: COO - Commerce Guys - Community Driven Innovation :.


                        MODx est l&#39;outil id