We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4172
    • 5,888 Posts
    &parents=`26`&tpl=`commadelimeted` &hideFolders=`1` &filter=`type,reference,9` &display=`10` &randomize=`1`


    gets 10 random resources with parent=26 and isfolder=0 and filters unwanted resources out and orders them randomized.
    so far I know you cannot use orderBy at same time.

    but you can order them in the second call and output them with your template and so on.
    I think this should work.
      -------------------------------

      you can buy me a beer, if you like MIGX

      http://webcmsolutions.de/migx.html

      Thanks!
      • 19889
      • 616 Posts
      Quote from: Bruno17 at May 31, 2010, 02:01 PM

      &parents=`26`&tpl=`commadelimeted` &hideFolders=`1` &filter=`type,reference,9` &display=`10` &randomize=`1`


      gets 10 random resources with parent=26 and isfolder=0 and filters unwanted resources out and orders them randomized.
      so far I know you cannot use orderBy at same time.

      but you can order them in the second call and output them with your template and so on.
      I think this should work.

      I tried the following code as suggested:
      [!Ditto?id=`dt3`&documents=`[[Ditto? &parents=`26`&tpl=`@CODE:[+id+],` &hideFolders=`1` &filter=`type,reference,9` &display=`10` &randomize=`1`]]`&tpl=`tpl-LinkListing`&orderBy=`longtitle, ASC`&language=`german`!]


      but that didn’t work - the output was sorted ASC but it was always the same output?!
        • 4172
        • 5,888 Posts
        was it random output from all and then ordered as needed?
        Then it did work. But only once.
        perhaps you have to make the resource uncached.
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 19889
          • 616 Posts
          Quote from: Bruno17 at May 31, 2010, 02:12 PM

          was it random output from all and then ordered as needed?
          Then it did work. But only once.
          perhaps you have to make the resource uncached.

          seems you’re right about making the page uncached - however, since I’ve the ditto call in my template I’m afraid I’d have to make all the pages uncached

          I tried to set the inner ditto call to uncached as well but that leads to an mysql error?
            • 4172
            • 5,888 Posts
            try it as one snippet:

            <?php
            //[!runditto!]
            
            $params['parents']='26';
            $params['tpl']='@CODE:[+id+],'; 
            $params['hideFolders']='1'; 
            $params['filter']='type,reference,9'; 
            $params['display']='10'; 
            $params['randomize']='1';
            $documents=$modx->runSnippet('Ditto',$params);
            $params=array();
            $params['id']='dt3'; 
            $params['documents']=$documents;
            $params['tpl']='tpl-LinkListing';  
            $params['orderBy']='longtitle ASC';  
            $params['language']='german';
            return $modx->runSnippet('Ditto',$params);  
             
             
            ?>
            
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 19889
              • 616 Posts
              Quote from: Bruno17 at May 31, 2010, 02:27 PM

              try it as one snippet:

              <?php
              //[!runditto!]
              
              $params['parents']='26';
              $params['tpl']='@CODE:[+id+],'; 
              $params['hideFolders']='1'; 
              $params['filter']='type,reference,9'; 
              $params['display']='10'; 
              $params['randomize']='1';
              $documents=$modx->runSnippet('Ditto',$params);
              $params=array();
              $params['id']='dt3'; 
              $params['documents']=$documents;
              $params['tpl']='tpl-LinkListing';  
              $params['orderBy']='longtitle ASC';  
              $params['language']='german';
              return $modx->runSnippet('Ditto',$params);  
               
               
              ?>
              


              Thanks again

              the above doesn’t return anything - no errors, nothing
                • 4172
                • 5,888 Posts
                you created a snippet with this code and named it ’runditto’.

                then you putted [!runditto!] on your template?

                And its output is nothing?
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 19889
                  • 616 Posts
                  I’m using an empty template to test and I put the snippet call into a new document.
                    • 4172
                    • 5,888 Posts
                    huh

                    and when you add

                    <?php
                    //[!runditto!]
                    
                    return 'the snippet runs';


                    into the snippet-code.
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 4172
                      • 5,888 Posts
                      empty template huh

                      without [*content*] ?
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!