We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28215
    • 4,149 Posts
    This article deals with MODx Revolution processors, and goes through an example, detailing how they are done in MODx Revolution.

    http://svn.modxcms.com/docs/display/~splittingred/2008/06/25/PHP+Coding+in+MODx+Revolution%2C+Pt.+III

    (Note: it might be a good idea to look at your modx revolution install while reading these, so you can understand futher.)
      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
      • 21257 MODX Staff
      • 730 Posts
      Thanks a lot for these articles Shaun, great stuff indeed.
      +1 blog subscriber ;-)
        Mike Schell
        Lead Developer, MODX Cloud
        Email: [email protected]
        GitHub: https://github.com/netProphET/
        Twitter: @mkschell
        • 16732
        • 592 Posts
        YESSS !!! Just what I was waiting for to start coding for the 097 .... more of these GREAT tutorials !! tongue
          • 29774
          • 386 Posts
          These articles are extremely helpful, thank you.
            Snippets: GoogleMap | FileDetails | Related Plugin: SSL
            • 22770
            • 285 Posts
            Sigh. You could be writing in Latin for all that means to me...

            So, for someone like me with pretty basic PHP knowledge--sufficient to write fairly simple snippets in 0.9.6--what do I need to learn before this stuff makes sense? laugh
              • 28215
              • 4,149 Posts
              Patrick,

              If you’re writing basic snippets with little DB interaction, then I doubt you’ll have to change much for 0.9.7. These tutorials mainly focused on database interaction and the API changes from 096-097. If you weren’t using those in 096, you wont have to worry about them for 097. smiley
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                • 22770
                • 285 Posts
                I was doing database interaction with things like $modx->db->select and so on, which seemed pretty easy to me. (See the attached snippet for an example, probably not very well coded!) My PHP can handle that kind of thing, but I’m wondering if I’ll be able to do similar things with the new system. Not that I’m against learning PHP properly, but I’m not sure where to start...
                  • 28215
                  • 4,149 Posts
                  Quote from: PatrickSamphire at Jun 26, 2008, 08:20 AM

                  I was doing database interaction with things like $modx->db->select and so on, which seemed pretty easy to me. (See the attached snippet for an example, probably not very well coded!) My PHP can handle that kind of thing, but I’m wondering if I’ll be able to do similar things with the new system. Not that I’m against learning PHP properly, but I’m not sure where to start...

                  Looking at your snippet, it’ll be far easier in 097.

                  For example:

                  // line 44,45
                  $fields_result = $modx->db->query("SELECT * FROM ". $content_table);
                  $numberfields = mysql_num_fields($fields_result);
                  
                  // changes to 
                  $numberfields = $modx->getCount('modResource');
                  


                  It looks like a lot of your snippet could be pared down and simplified with the new API.

                  http://docs.modxcms.com/ - also has the PHPDocs for the 097 PHP API.
                    shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                    • 22770
                    • 285 Posts
                    Quote from: splittingred at Jun 26, 2008, 08:32 AM

                    http://docs.modxcms.com/ - also has the PHPDocs for the 097 PHP API.

                    This makes my head explode every time I look at it. grin
                      • 28215
                      • 4,149 Posts
                      Patrick,

                      Well, the next few articles will describe the process of creating an 097 Component, so that will probably help you get started. Hopefully we’ll have those out in a bit.
                        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com