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

    Can someone point me in right direction on how start understanding the concepts behind 097.
    I would like to use this release to improve my understanding of php/mysql/xml etc.

    Thx
      • 28215
      • 4,149 Posts
      For starters, there is the Confluence wiki:

      http://svn.modxcms.com/docs/display/MODx097/MODx+0.9.7

      (which is not finished, we know)

      And then there’s the MODx API documentation:

      http://docs.modxcms.com/

      And the JS docs:

      http://docs.modxcms.com/modext/

      More to come, as soon as we get some documentation contribs...
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 5340
        • 1,624 Posts
        I know that 097 is also a framework.

        I would like to play with an application on Adobe Air that uses the modx framework.
        Any points on where to start, what do I need to set up, what files do I need?

        Basically I need only to access the database using ajax request from my AdobeAir app

        thx
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: xpix at May 01, 2008, 09:26 AM

          I would like to play with an application on Adobe Air that uses the modx framework.
          Any points on where to start, what do I need to set up, what files do I need?

          Basically I need only to access the database using ajax request from my AdobeAir app
          Do you mean you want to bypass the MODx request handling and use custom PHP scripts with the modX class, or that you simply want to build and manage resources (formerly documents or pages) in MODx that will serve content to the AdobeAir app? I’m not that familiar with how AdobeAir works, so pardon me if I am asking the wrong question...
            • 5340
            • 1,624 Posts
            The application is a combination of a project management tool and time recording
            So the application will have users with diffrent roles.

            To start I would like to use modx API to connect to the database. Something like you would do with the DB pear package.
            Next step will be to check if modx’s user management is the one I need to define roles for the users.

            Since a project is a document with diffrent TVs (a different number of tv’s for each project, they might be the same) each document might need a diffrent template so I would need to create templates on the fly every time a project is created.

            right now I am just proofing the concept so I am not really sure what I want either smiley

            Here is how I think the app will work
            From adobe air I will be querying php files, something like Ajax requests. In those php files I would like the load the Modx framework and use it instead of creating my on classes. I would like to know what will I need from the modx package to make it work.

            Ex: Create a new project:
            modx->createDocument(parameters);
            modx->addTV(name1,DocumetID);
            modx->addTV(name2, DocumetID);

            Ex2: Create Users
            modx->addUser(name1,role1);
            modx->addUser(name2,role2);

            Hope this helps



              • 22303 MODX Staff
              • 10,725 Posts
              Quote from: xpix at May 01, 2008, 12:22 PM

              To start I would like to use modx API to connect to the database. Something like you would do with the DB pear package.
              Next step will be to check if modx’s user management is the one I need to define roles for the users.
              The secret here is understanding the foundation of the new MODx, which is xPDO. In the new architecture, the old DocumentParser class is gone, replaced by the modX class, which just so happens to be a subclass of xPDO. An xPDO object represents a unique connection to the MODx database, and, in the case of modX, decorates the xPDO class with content management functionality. And to understand xPDO, you would do well to first understand PDO itself. xPDO is designed to quickly provide a domain model (i.e. the classes defining your application) for a relational model (i.e. the database tables responsible for storage of persistent objects), and the relational layer, including scaffolding (a.k.a. CRUD), are made possible through PDO.

              So now, instead of writing SQL queries to access MODx data, there is a complete set of classes with a consistent set of methods for working with all of the data MODx deals with.

              Quote from: xpix at May 01, 2008, 12:22 PM

              Since a project is a document with diffrent TVs (a different number of tv’s for each project, they might be the same) each document might need a diffrent template so I would need to create templates on the fly every time a project is created.
              Quite simple to achieve, something like this (authentication/security issues not covered here; you would need to create some kind of service for your application to use to login and get a valid user session with proper permissions to do these things):
              <?php
              $template = $modx->newObject('modTemplate');
              $template->set('templatename', 'NewTemplateName');
              $template->set('description', 'my new template');
              $template->set('content', '<html><head></head><body></body></html>');
              if ($template->save()) {
                  // template was successful
              } else {
                  // save failed; handle the error
              }
              ?>


              Quote from: xpix at May 01, 2008, 12:22 PM

              Here is how I think the app will work
              From adobe air I will be querying php files, something like Ajax requests. In those php files I would like the load the Modx framework and use it instead of creating my on classes.
              While that is certainly a valid approach, why not let MODx manage your Ajax services? These are after all just MODx resources that respond to URL’s. You’re replacing an MVC framework with individual PHP files at that point; why give up all the advantages MODx will provide in helping you manage those services?

              Quote from: xpix at May 01, 2008, 12:22 PM

              I would like to know what will I need from the modx package to make it work.
              <?php
              define('MODX_CORE_PATH', '/path/to/core/');
              define('MODX_CONFIG_KEY', 'config');
              require_once(MODX_CORE_PATH . 'model/modx/modx.class.php');
              $modx= new modX();
              $modx->initialize('contextname');
              ?>


              Quote from: xpix at May 01, 2008, 12:22 PM

              Ex: Create a new project:
              modx->createDocument(parameters);
              modx->addTV(name1,DocumetID);
              modx->addTV(name2, DocumetID);

              Ex2: Create Users
              modx->addUser(name1,role1);
              modx->addUser(name2,role2);
              <?php
              // create a document and pass all the field values as an associative array
              $document = $modx->newObject('modDocument', $parameters);
              // now save...
              $document->save();
              
              // first get the modTemplateVar objects representing a template variable
              $tvX = $modx->getObject('modTemplateVar', array('name' => 'X'));
              $tvY = $modx->getObject('modTemplateVar', array('name' => 'Y'));
              
              // now set values for them for specific documents if they are unique values
              // (otherwise, they automatically get the default_text value for the TV via the template)
              $tvX->setValue($document->id, 'new value for X and new document ' . $document->get('id'));
              $tvY->setValue($document->id, 'new value for Y and new document ' . $document->get('id'));
              ?>

              Hope that helps a little...
                • 5340
                • 1,624 Posts
                nice homework grin

                Thank You