We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19604 ☆ A M B ☆
    • 179 Posts
    I want to create some direct links to make some resources more prominent:
    [[getResources?
    &parents=`-1`
    &resources=`32,408,113,34,412,41,68,329,93` 
    &limit=`0` 
    &tpl=`menuTpl` ]]

    The output resources shall be ordered like the input was ordered, i.e. "32,408,113,34,412,41,68,329,93". The only way to achieve that is by doing this here:
    [[getResources?
    &parents=`-1` &resources=`32,408,113,34,412,41,68,329,93` 
    &sortby=`FIELD(modResource.id,32,408,113,34,412,41,68,329,93)` &sortdir=`ASC`
    &limit=`0` 
    &tpl=`menuTpl` ]]

    Am I right? No easier way than to repeat the resources in the "sortby"?

    Maybe a different snippet would suit my needs better, right? Any recommendation?

    thanks
    Oliver

    P.S.: A misplaced feature request for gR: Something like "sortby='resources'" would be awesome! Anybody here who agrees with me?
      MINDEFFECTS – DESIGN for PRINT, WEB and MEDIA
      http://twitter.com/mindeffects · http://www.facebook.com/mindeffects · http://www.youtube.com/mindeffects/ · skype://mindeffects_oliver
      • 4172
      • 5,888 Posts
      Am I right? No easier way than to repeat the resources in the "sortby"?

      some ways:

      snippet 'getByResourcesSortedResources':

      <?php
      
      $scriptProperties['sortby'] = 'FIELD(modResource.id,' . $resources .')';
      
      return $modx->runSnippet('getResources', $scriptProperties);
      


      [[getByResourcesSortedResources?
      &parents=`-1` 
      &resources=`32,408,113,34,412,41,68,329,93`
      &sortdir=`ASC`
      &limit=`0`
      &tpl=`menuTpl` ]]


      or:

      chunk 'getByResourcesSortedResources'

      [[getResources?
      &parents=`-1` 
      &resources=`[[+resources]]`
      &sortby=`FIELD(modResource.id,[[+resources]])` 
      &sortdir=`ASC`
      &limit=`0`
      &tpl=`menuTpl` ]]


      [[$getByResourcesSortedResources? &resources=`32,408,113,34,412,41,68,329,93`]]








      [ed. note: Bruno17 last edited this post 13 years, 8 months ago.]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 19604 ☆ A M B ☆
        • 179 Posts
        Quote from: Bruno17 at Feb 12, 2013, 11:54 AM

        some ways:
        snippet 'getByResourcesSortedResources':
        or:
        chunk 'getByResourcesSortedResources'
        Wow! I salute your genius!! THANKS BRUNO!!!
          MINDEFFECTS – DESIGN for PRINT, WEB and MEDIA
          http://twitter.com/mindeffects · http://www.facebook.com/mindeffects · http://www.youtube.com/mindeffects/ · skype://mindeffects_oliver