We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11055 ☆ A M B ☆
    • 3,112 Posts
    Quote from: tkfm at Sep 27, 2010, 02:22 AM

    No. The default value of sortBy parameter is "DESC".
    See the default property of FirstChildRedirect snippet.

    So, what does this part suppose to mean?
    <?php // highlight
    
    /* sort dir */
    $sortDir = isset( $sortDir ) && $sortDir == 'DESC' ? $sortDir : 'ASC';
    


    or should it be:
    <?php // highlight
    
    /* sort dir */
    $sortDir = $scriptProperties['sortDir'] == 'DESC' ? $scriptProperties['sortDir'] : 'ASC';
    

      Rico
      Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
      MODx is great, but knowing how to use it well makes it perfect!

      www.virtudraft.com

      Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

      Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

      Maintainter/contributor of Babel

      Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
      • 3749
      • 24,544 Posts
      No, is says that if it’s set and it’s ’DESC’ $sortDir = $sortDir (i.e., ’DESC’). If not, $sortDir = ’ASC’.

      If there were no default property, it would be set to ’ASC’ by default, but since the default property is ’DESC’, that’s the default value. It is potentially confusing to people (like me) who look at the code and don’t know about the default property.

      It’s designed to handle cases where the user sends something weird as a parameter (which would override the default property) or modifies the default parameter to something weird. Otherwise, the query might fail altogether. This way, it’s guaranteed to produce something.

        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Indeed, the concept is much like the difference between Templates (site templates) and tpls (mini-templates used by snippets to permit custom structuring of their output). There are system defaults that you can set, and there are defaults for the snippet itself in case there is no system default. I always think of MODx as the city hall; it has its rules and customs, then there snippets and other code module that are like my private household which operates within the city’s rules but has its own rules and customs. The city has no laws against my kid picking his nose at the supper table, but he won’t get much supper if he tries it at home! So the city (in the US, in any case, certainly not here in Israel!) probably has a law against spitting on the sidewalk, while at home I have laws against publicly picking one’s nose.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 3749
          • 24,544 Posts
          Nice analogy. cool

          I think people are also confused by the difference between settings and properties.

          Settings are available across the whole site (global scope).

          User Settings override Context Settings, which override System Settings.

          Properties are available in specific elements (local scope)

          Properties set with parameters (&propertyname=`value`) override properties in attached property sets, which override the element’s default properties.

          Inside a snippet (or other element) it’s impossible to tell where a property or setting’s value came from because the overrides happen at a higher level -- before the value reaches the element.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 19309
            • 49 Posts
            Is there any reason why the snippet creates 302 redirects? This is a cardinal error from an SEO point of view. Permanent redirects (301 redirects) should be the default, especially because not every web developer using the snippet knows about the SEO influence of the redirect type.

            This can be achieved easily by a small change in the last line of the snippet, see below.

            302 redirect, bad for SEO (= current snippet version):
            return $modx->sendRedirect($url);​


            301 redirect, good for SEO:
            return $modx->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.1 301 Moved Permanently');​
              • 12
              • 4 Posts
              I have some problems with sortBy.
              I have TV called "total_area". Snippet is called [[!FirstChildRedirect? &sortBy=`total_area`]] and do not works! But with default value works fine.
              Friendly URLs are turned ON.
                • 31671
                • 13 Posts
                Hello All,
                is there a update, fix or workaround to get the firstchildredirect working again in 2.1 rc3?