We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4385
    • 372 Posts
    I would like to use a much of the standard snippets as possible.

    I tried using Ditto, but I could only get it to work with documents, and not a custom db table.
    It would be nice to be able to create little blocks of content from a table (last five entries) etc.
      DropboxUploader -- Upload files to a Dropbox account.
      DIG -- Dynamic Image Generator
      gus -- Google URL Shortener
      makeQR -- Uses google chart api to make QR codes.
      MODxTweeter -- Update your twitter status on publish.
      • 25663 MODX Staff
      • 12,272 Posts
      Ditto can use any custom template you want. Put a Ditto call inside an opening and closing table-tag and use a template for Ditto that builds the rows.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 4385
        • 372 Posts
        I am not sure I understand, or I did not make myself clear. I was referring to mysql table.

        I am creating a snippet that will return the 5 latest items by date using DBAPI.
        But I will need to create a larger list and would like to paginate, without reinventing it.
          DropboxUploader -- Upload files to a Dropbox account.
          DIG -- Dynamic Image Generator
          gus -- Google URL Shortener
          makeQR -- Uses google chart api to make QR codes.
          MODxTweeter -- Update your twitter status on publish.
          • 25663 MODX Staff
          • 12,272 Posts
          Use the makeTable class.... I definitely didn’t get it right the first time!
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 6437
            • 157 Posts
            This snippet may help http://modxcms.com/forums/index.php/topic,14654.0.html. Although unfortunately it doesnt contain all the Ditto features.

            Steve
              • 4385
              • 372 Posts
              Thanks Ryan! The MakeTable class was more of what I looking for. It has a few rough edges...

              cons

              • class path wrong
              • order by - hard coded to certain field names in the class
              • parameters in each snippet
              • uses tables

              pros

              • pagination
              • sorting
              • custom sql

              but, over all a good example db code

              Steve, Thank you for the loopDbChunk link!

              cons

              • no pagination
              • no sorting

              pros

              • divs, not tables
              • chunks, placeholders
              • input parameters

              This looks like the most promising, easier to setup and get going.

              grin I just have to wait for pagination!

              Thanks again for the help. I fell confident I made the right choice with MODx





                DropboxUploader -- Upload files to a Dropbox account.
                DIG -- Dynamic Image Generator
                gus -- Google URL Shortener
                makeQR -- Uses google chart api to make QR codes.
                MODxTweeter -- Update your twitter status on publish.