We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25663 MODX Staff
    • 12,272 Posts
    OK it looks like we need to adjust the installer to make sure the snap-in top menu (menu4) is the default.

    Any other fixes needed?
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 13577
      • 302 Posts
      I have a need that I’d REALLY like to see integrated into a very near release. The auto menuindex feature really throws me off. My menus are designed to alphabetize by default *unless* there is a specific menuindex given. Therefore, a default of 0 is very nice in most circumstances. And when I need a specific order, I can set my menuindex accordingly, and it will override the alphabetizing in the menu snippets. So my proposal is that this is a config option- to have menu index be automatic or not by default.

      To reduce workload - I have already compiled a list of all the changes that need to be made, and tested it. It seems to work just fine (I’m using it in my production site). The changes are not complex. I will attach the doc of changes here.

      Am I the ONLY one who doesn’t use menuindex to sort my menus!??!?! shocked I am forever forgetting to change the menuindex of new docs to 0.
        Standard Disclaimer
        I could be totally wrong.
        • 1764
        • 680 Posts
        I’m with you on this one. Right now we sort our menus alphabetically unless a menuindex exists. For our new site I’m planning on having a TV option to sort alpabetically or by creation date (for news and such) so I would like to see this option added too.
          • 24253
          • 125 Posts
          As noted before, please run your code with this in index.php:

          // Added by Remon
          // Debugging mode:
          $modx->stopOnNotice = true;


          As a matter of fact, this should be on during development, instead of trying to have developers do it manually each time they upgrade their modx dev version.

          Thanks ;-)

          Remon

          (As a tester, I see the php warning notices, report them in the forum, but they don’t get fixed. This makes testing a little cumbersome...
          HINT: NewsListing snippet developers.... : Undefined variable: sortby)
            • 25663 MODX Staff
            • 12,272 Posts
            LOL... for many smallish marketing sites, I add the pages in the order they’re needing to be in the menu, and the auto menu index updates, automatically! So it works great for me. I think we should move this to a System pref.

            On a very much related note, I’d really like to see the tree menu sort order better addressed or likewise moved to preferences, per To Do item #14.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 25663 MODX Staff
              • 12,272 Posts
              Remon, what would be an appropriate way to declare a variable to prevent the warning notice?
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 24253
                • 125 Posts
                OK, here it goes:

                if (true)
                	{
                	$myVar = $modx->getSomeVar();
                	}
                return $myVar;
                


                $myVar is declared (or is it defined, or both? not sure how that works in php, anyways) in the scope of the "if(true) { }
                So,it’s not possible to use it outside those {    }

                EDIT: Seems not to work as I thought first :-(
                ///////////////
                A simple fix would be to declare it first:

                var $myVar;
                
                if (true)
                	{
                	$myVar = $modx->getSomeVar();
                	}
                return $myVar;
                

                //////////////////////

                Well, if $myVar would be a string or something, this will do:

                $myVar = '';
                
                if (true)
                	{
                	$myVar = $modx->getSomeVar();
                	}
                return $myVar;
                



                Now, something else to catch:

                $myVar = $_GET['start'];
                


                What if $_GET[’start’] doesn’t exist?
                This is nicer, and fixes the warning above codes produces if $_GET[’start’] doesn’t exist:

                $start= isset($_GET['start'])? $_GET['start']: 0;
                


                Use the "isset(  )" to make sure you reference something that exists.

                This doesn’t work neither:
                $debug = isset($debug)? $debug : 0;
                
                html_substr($posttext, $minimum_length, $length_offset) {
                       if($debug) {
                           echo "HELP";
                        }
                }
                
                $output .= html_substr($posttext, $minimum_length, $length_offset);
                


                Instead, you have to do something like this:

                $debug = isset($debug)? $debug : 0;
                
                html_substr($posttext, $minimum_length, $length_offset, $debug) {
                       if($debug) {
                           echo "HELP";
                        }
                }
                
                $output .= html_substr($posttext, $minimum_length, $length_offset, $debug );
                


                If someone has a better solution?

                This one works actually, but ehm, $sortby = $sortby seems a bit redundant?
                if(isset($sortby) && in_array($sortby,$dbfields)) {
                   $sortby = $sortby;
                } else {
                   $sortby = "createdon";
                }
                


                OK, on request, here’s an updated NewsListing snippet. PLEASE test!
                  • 1764
                  • 680 Posts
                  I just commited my fix for separate resource folders for manager users. This should get some testing before we release.

                  More details here
                    • 24253
                    • 125 Posts
                    Testing the new topmenu with the Dutch translation here, and when in Configuration menu, the total horizontal space used is a bit tooo much :-(
                    Now, some translated words could be made a little shorter, but still...

                    Perhaps, the spacing between the menu items can be made a little smaller?

                    Looks great btw!

                    Remon
                      • 24253
                      • 125 Posts
                      Aje, found a nice and very visible bug, maybe it’s solved allready, but QE looks in it’s own lang directory for the current set lang in the manager.
                      But there is only the english lang file in QE lang dir, so it failes for all other languages.

                      Please, have a look at this!

                      It fails on line 58, output.inc.php

                      Remon