We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12645
    • 9 Posts
    I trying to build a snippet to show the children of a document as houses for rent. I am a php beginner(currently studying functions in class) and so ive never worked with an APT. So please bare with me if i sound retarded.  How do I access the child images and content to make something like the picture below appear on the parent. How do i access the database part... im sure ill be fine once i can form an array with the info... but getting the info from the modx is whats getting me. Or is it ok to connect to the databse directly and build my SQL queries directly?

    my drawing is gpl hahah
      • 12645
      • 9 Posts
      Also im a bit confused they api documentation will list getRecordCount(); but when i look at other people example i see $modx->db->getRecordCount();

      Why was $modx->db-> added?

      So does that mean that I would use it as such...
      $int_total_children = $modx->db->getRecordCount($numlist);

      sorry for all the questions...
        • 4172
        • 5,888 Posts
        Why not using Ditto for that?
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 7231
          • 4,205 Posts
          I would recommend using Ditto as well, that is exactly what it is for.

          And to answer your question you always need to add $modx-> to use an api function (that is how you identify that it is part of the $modx object). In the example above you are calling the db api and using the getRecordCount() function.

          The api documentation in the documentation is well supplemented with the documentation in the wiki, but there are several missing links and sometimes looking at how someone else used it is the only way to understand it.
            [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't know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 12645
            • 9 Posts
            Thanks for the response guys, Ditto would make that easy... i just want to practice my php/snippet creation a bit and it seemed like it wouldn’t be that hard.