We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23041
    • 16 Posts
    Hi,

    First post here, as we’re about to release our new site based on ModX. This is a wonderful CMS, except for one thing that absolutely blows my mind -- the fact that &, ? and = are parsed instead of transmitted.

    Why is it that every other compiler and interpreter in the world has no problem escaping characters so they get treated as literals, e.g. \", \’, \$ etc. etc. etc., but ModX can’t?

    Every time someone has tried to address this incredible oversight, the message is simply that it "isn’t supported", and that’s apparently the end of it. But I can’t believe that the developers are able to code such a marvelous CMS, and at the same time be unable to code one of the most basic and ancient compiler functions.

    In time, I may become familiar enough with ModX that I’ll be able to contribute code. But until then, I find the argument that it’s simply not supported a little bit ridiculous, especially with the usual suggestion of passing these characters as e.g. %%AMP%% and doing a str_replace on the submission afterwards. This is not exactly a brilliant use of CPU resources. I know you’re concerned about this, because you even recommend that people don’t use $variable inside a string but instead concatenate, because it’s supposedly more efficient.

    I really hope that the developers will reconsider and just put a darn escape parser into the parser. I don’t think it needs defending.

    Meanwhile, I’ll of course have to do multiple layers of str_replace at the top of every snippet. But this is ugly code, and I find the reason meaningless. It’s a made-up limitation.

    Sorry that my first posting is a bit of a grudge. I’m otherwise thrilled with ModX and already an evangelist. I’ll also contribute a module at some point to interface WayFinder with SoThink DHTML menu, which we’re using right now, but it’s not portable enough yet. This allows for much more sophisticated menus than WayFinder, complete with Separators and a lot of other stuff.

    So thanks, and I hope you will look into this one more time.

    Best,

    Per
      • 23041
      • 16 Posts
      A little extra note, some compilers simply escape special characters by requiring them to be printed twice, e.g. $$ or \\.

      Wouldn’t it be as simple as leaving any double-occurences of $, ? and = alone, and then as the last step str_replace them with single characters?

      I find it implausible that this is beyond the coder’s abilities. Again, in a year or two, I might be able to do this myself. But right now, it’s counter-intuitive at the highest level. I have never ever seen a compiler that couldn’t do this, it’s a standard and required feature. How else are you going to pass markup? For starters, our company name has an & in it. But even passing text or URLs or whatnot is impossible without massive converting. Then it’s almost like one has to write a PHP script to ModX escape text before copy/pasting, which I think is wild. If you have a snippet-driven text-box, you can’t simply copy-paste some text into it, especially foreign languages, and you can’t even html encode it.

      It should be a small task for ModX to detect if it’s inside a backtick or not, and this could easily be nested with a stack for nested snippets.

      By the way, I’m 1.0.0. I don’t know if this works in 2.0.0, but we’ll wait until it’s production ready.

      Per
        • 20413
        • 2,877 Posts
          @hawproductions | http://mrhaw.com/

          Infograph: MODX Advanced Install in 7 steps:
          http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

          Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
          http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
          • 23041
          • 16 Posts
          Hi,

          I certainly appreciate that guy’s effort to solve the problem by hacking the parser, but it is a strict rule on our site that no changes whatsoever are made to the core code -- this is a sure way to crash a site after an upgrade. So we simply can’t. Whatever the solution is, it has to work always.

          Plan B is obvious, but IMO is really awful bad programming:

          <?php
          	function escape($body)
          	{
          		$body=str_replace('%%AMP%%', '&', $body);
          		$body=str_replace('%%QUE%%', '?', $body);
          		$body=str_replace('%%EQU%%', '=', $body);
          		return $body;
          	}
          ?>


          It seems to me to be a trivial task to write this is if you already know how the parser works. It should also be no problem to stay compatible with nested chunks and snippets. The tick-stack concept would do the trick.

          Thanks for your reply!

          Best,

          Per


            • 20413
            • 2,877 Posts
              @hawproductions | http://mrhaw.com/

              Infograph: MODX Advanced Install in 7 steps:
              http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

              Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
              http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
              • 16183
              • 1,390 Posts
              Quote from: perholmes at Jun 19, 2009, 12:16 AM

              I’ll also contribute a module at some point to interface WayFinder with SoThink DHTML menu, which we’re using right now, but it’s not portable enough yet. This allows for much more sophisticated menus than WayFinder, complete with Separators and a lot of other stuff.

              Best,

              Per


              Per, welcome to MODx! Really looking forward to this module. I am sure you must be very busy but do you have a time scale on this? Many thanks.

              cheers/k
                • 23041
                • 16 Posts
                Hi there,

                I was actually thinking that when I’m ready (we’re going live with the new site in a week so definitely not now!), I would find someone to partner with (perhaps you?) and then figure out a way to make it universal and compatible ... and non-stupid, I’m sure I have a lot of code in there as leftovers from Wayfinder that doesn’t need to be there.

                In short, how it works is that I design an HTML menu in SoThink, completely with all the design options you have. The menu is 4 levels deep, and each level has e.g. 5 different kinds of menus, i.e. a normal menu, a disabled menu, a separator, a menu with children, an inline highlight (an inert menu-item that just describes the following items). The menu items where text can be changed have the words %%MENUTEXT%% in them. In addition, SoThink has an option to insert code right before and after a menu, and I’m inserting specially named comments to make the code searchable, which is important next.

                Then my code parses the resulting SoThink DHTML file and saves all these chunks in arrays. Then it uses some code from Wayfinder to traverse the menu-tree, and assembles the SoThink chunks according to the ModX tree. In addition, the Weblink can be %%NOLINK%%, which makes it unclickable, and the Menu Title can be %%SEPARATOR%%, which renders a separator. Then you simply insert these "dead" separator items into the menu tree where you want separator. The parser automatically determines how to get down in the hierarchy.

                Then it includes their javascript module and outputs the code, and voila, there’s a killer menu.

                I’ll post a link as soon as we’re live. It looks much better than Wayfinder.

                Best,

                Per
                  • 16183
                  • 1,390 Posts
                  Is SoThink DHTML not a commercial product though? How would that work out?

                  cheers
                  /k
                    • 23041
                    • 16 Posts
                    Hi there,

                    Yes, it is, and it shows. The Windows application is where you design the menu, but the result is a Javascript file that you’re free to put on your website. All I’m doing is loading the menu with tags, the parse and rearrange the javascript file.

                    So yes, it would require you to own SoThink DHTML Menu in order to design your menu -- presumably I’m the only one in the world who wants to use my template. But once you own it, you simply load a project file, tweak it until it looks the way you want it (without changing the basic structure), export the java, and my code reads the java and rearranges it according to the ModX tree. So anyone who wants to use have any influence on the look of their menu will need to buy the software.

                    I’m trying to figure out how to post images, then you can see.

                    Best,

                    Per
                      • 16183
                      • 1,390 Posts
                      Quote from: perholmes at Jun 19, 2009, 06:24 AM


                      I’m trying to figure out how to post images, then you can see.

                      For the time being that’s not possible due to some vulnerability in SMF. Post externally please.

                      cheers/k