We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3763
    • 155 Posts
    Hey, thanks for the reply!
    Yes, but you need to set multilevel=1 for that to work at the moment.

    I still need to add a check to say if there are commas in the list, use the advanced method...
    It worked great that way, but I wanted to improve a bit and made some changes grin

    I have posted my code ...
    $multilevel is used just to force NO-multilevel, the rest goes all automatically.
    First $startID is cleaned, just numbers are kept back and commas. Multiple commas, or commas on first/last position are also removed. If user forces to use no multilevel with &multilevel=0 just the first ID is used, the rest including commas is removed. Else $multilevel is automatically set to 1 and all IDs are used.
    <?php
    //Define the pattern to search for
    $pattern = array( '`([^,\d])`',  //All chars except commas and numbers
                      '`(,)+`',      //Multiple commas
                      '`^(,)`',      //Comma on first position
                      '`(,)$`'       //Comma on last position
                      );
    
    //Define replacement parameters
    $replace = array( '',
                      ',',
                      '',
                      ''
                      );
    
    //Clean startID (all chars except commas and numbers are removed)
    $startID = preg_replace( $pattern, $replace, $startID );
    
    //If multilevel is forced to zero... keep first ID, remove the rest
    if(isset($multilevel) && $multilevel == 0)
       $startID = preg_replace( '`^([\d]+)(,)?(.)*`', '$1', $startID );
    else
       $multilevel = 1;
    ?>

    Put this just before:
    <?php
    $resourceparent = isset($startID) ? $startID : $modx->documentIdentifier;
        // the folder that contains post entries. separate multiple folders by comma when multilevel is equal to 1.
    ?>


    The following code can be removed:
    <?php
    $multilevel = isset($multilevel)? $multilevel : 0;
    	// automatically detect and show children to the descendentDepth level
    ?>


    I hope you don’t get mad because of the changes I made. If you want to use this for the snippet, you are welcome.

    Tested it a bit with 4 level deep folders, and it works fine (at least for me).

    Later Edit: Quick example, if you enter bad IDs like "$%^,,,,3,5,8..,6abc,,,,", the code will clean the string and you have the corect IDs "3,5,8,6"

    Cheers, Boby.
      ...my Photo Gallery on Flickr...
      • 18397
      • 3,250 Posts
      Very cool Boby! I’ll test this out with the development code and it will hopefully make it into the next release.
        • 3763
        • 155 Posts
        There was a small problem in the code, updated it now. I don’t know if someone else edited my previous message (perhaps not) or I have added a crappy line somehow huh

        There was a textarea and div code in an element (Comma on last position) of the $pattern array...strange undecided

        Boby
          ...my Photo Gallery on Flickr...
          • 8382
          • 253 Posts
          Hi, Mark.
          I had a trouble with NewsListing v6.3.3 in &format=`rss`.
          NewsListing snippet outputed wrong strings, at rsspagetitle and rssusername, in a rss file.
          My pagetitles and users’ fullname are written in japanese wtih UTF-8 encoding.
          I finally solved this with following modifications.
          line 305.
          $xmlheader =  '<?xml version="1.0" encoding="'.$modx->config['etomite_charset'].'"?>'."\n".
          
          line 581
          		$placeholders['[+rsspagetitle+]'] =  htmlentities($resource[$x]['pagetitle'], ENT_QUOTES, $modx->config['etomite_charset']);
          
          line 583
          		$placeholders['[+rssusername+]'] =  htmlentities($author, ENT_QUOTES, $modx->config['etomite_charset']);
          

          I don’t know why rss file encoding fixed to ISO-8859-1.
          But, please take this issue into consideration.

          Thanks.
            • 25663 MODX Staff
            • 12,272 Posts
            Great stuff Boby. smiley You might want to add a reference to this particular thread in the Newslisting Project on the bug tracker so we don’t forget about it.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 4273
              • 356 Posts
              is 6.3 the official version or 6.5 ?


              how to get the page 1 of 4 articles and previous / next links to show up in the page
                SMF Bookmark Mod - check it out
                http://mods.simplemachines.org/index.php?mod=350
                • 18397
                • 3,250 Posts
                The code that was going to be in 6.5 is in 6.3.3 or 6.4.1 (the two official releases).

                All you need to do is turn paginate on and add the correct placeholders to your document.
                  • 4273
                  • 356 Posts
                  cool now how do we turn on paginate he he what is paginate?
                    SMF Bookmark Mod - check it out
                    http://mods.simplemachines.org/index.php?mod=350
                    • 18397
                    • 3,250 Posts
                    Append &paginate=1
                      • 4273
                      • 356 Posts
                      so the complete call on the page would like this ?

                      [[NewsListing? &startDoc=`58` &paginate=’1’]]


                      I tried it and no luck, can see the articles just not the page 1 of 4 and links
                        SMF Bookmark Mod - check it out
                        http://mods.simplemachines.org/index.php?mod=350