We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1373
    • 12 Posts
    Hi all,

    A new version is available to download from the first post of this thread.

    changes from previous version:
    - pagination support
    - 2 new parameters: perPage - number of items per page
    numLinks - number of visible links from each side of the current page number
    - the parameter ’limit’ is now obsolete

    any feedback is welcome!

    Amir
      • 7885
      • 40 Posts
      hi amirm, this snippet really rocks, but i have a little problem, i dont know if you could fix this:

      i need to use the same place holder twice for make a links like the following:

      <a href="#" onclick="new Link('borrar','[+id+]');" title="borrar">delete</a>
      <a href="#" onclick="new Link('editar','[+id+]');" title="editar">edit</a>
      


      but the snippet only returns one [+id+], the other is left in blank... is there a easy way to fix this?

      thanks in advance
        visit us at www.dospuntocero.cl
        • 1373
        • 12 Posts
        dospuntocero, I have uploaded a version which fixes it.
        Please check it out and let me know whether it solved your problem.

        Amir
          • 7885
          • 40 Posts
          now works perfect !!! laugh

          thanks for that!

          by the way...

          in the snippet file you have a typo

          <?php
          /******************************************
          * Snippet: loopDbChunk ...
          * parameters:
          *
          * tableNane - the relevant table name (required) <- must say tableName grin
          *


          thanks for all!!
            visit us at www.dospuntocero.cl
            • 7885
            • 40 Posts
            if i make a query like the one in the next line, the class (or modx) cuts it when the first equal sign appears, showing the following error:

            query:

            Select Cer_Nombre,NombreNave,Cem_FechaEmision,Cem_UsuarioEmisor from Certificados,CertificadosEmitidos,Naves where Certificados.Id=CertificadosEmitidos.Certificados_Id and CertificadosEmitidos.Naves_Id=Naves.Id and Naves.Propietarios_Id=1

            error:

            « MODx Parse Error »

            MODx encountered the following error while attempting to parse the requested resource:
            « Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’"Select Cer_Nombre,NombreNave,Cem_FechaEmision,Cem_UsuarioEmisor from Certificad’ at line 1 »
            SQL: "Select Cer_Nombre,NombreNave,Cem_FechaEmision,Cem_UsuarioEmisor from Certificados,CertificadosEmitidos,Naves where Certificados.Id

            note that te sql passed to loopdbchunk is trimmed in the first = , lossing complete coherence and creating an error


            if i put the sql code in the phpMyAdmin, it returns the requested data without problems
              visit us at www.dospuntocero.cl
              • 7231
              • 4,205 Posts
              Finaly got around to using this snippet and must say it is great. Very easy to use and very flexible. Great for displaying custom table data. Thanks.

              Would be nice to add edit/delete options for the rows. wink
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don&#39;t know what it is.
                Do you, Mr. Jones? - [bob dylan]
                • 34017
                • 898 Posts
                cw,

                for editing: create a link to an eform page where you edit the page.

                for deleting: create a snippet that looks for "delete_id" or something. Then generate the form in line with loopdb. (of course these functions should be protected with superadmin or user permissions)

                I did this with one site and it’s worked pretty well.
                  Chuck the Trukk
                  ProWebscape.com :: Nashville-WebDesign.com
                  - - - - - - - -
                  What are TV's? Here's some info below.
                  http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
                  http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
                  • 7231
                  • 4,205 Posts
                  ProWebscape: Thanks for the tips, it is along the lines of what I was considering.
                    [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                    Something is happening here, but you don&#39;t know what it is.
                    Do you, Mr. Jones? - [bob dylan]
                    • 7231
                    • 4,205 Posts
                    Is there any way to add PHx support like in Ditto? That would be cool.
                      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                      Something is happening here, but you don&#39;t know what it is.
                      Do you, Mr. Jones? - [bob dylan]
                      • 24622
                      • 12 Posts
                      Installed LoopDbChunk and it works great: But I have a question, the data I’m displaying is about 139 pages long. How would I get it to just display a range of records, such as list names A through D? I’ve been reading up on mysql but can’t find anything on querying a range of names.
                        Just because I don&#39;t know what I&#39;m doing, it has never stopped my from breaking something.