We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Yes, How Revolution exactly works?

    I started learning and working with MODx new version, I searched and read many tutorials and docs about it and it’s coding instruction.

    I found modx and xpdo documentations which introduce classes and details but couldn’t find bridges it means you explained all parts of a great system with details but there is no explanation about those philosophy. i really didn’t know how to join them for my purposes.

    I read splittingred’s blog, he has written about coding in Revolution but he hasn’t told anything about meaning of steps.

    Knowing previous version instruction is easier but Revolution is completely different.

    summary, I want to know what is the system of nested folders, in splittingred’s snippet creation tutorial i didn’t know why the plenty of folders need, why is it impossible to place all files in a few folders with simpler instruction.

    i want to know how MODx Revolution works, what is difference with it’s behavior with process documents in Revolution and previous versions?

    I tried hard to tell my purpose! undecided


    Thanks
    AHHP
      God loves me. 【ツ】


      MODX.ir (Persian Support)

      Boplo.ir/modx/ (Persian)
    • Quote from: AHHP at Aug 23, 2008, 04:22 PM

      Yes, How Revolution exactly works?
      That’s a question with only one sensible answer: it’s magic! I jest, but seriously, that is a rather all-encompassing question that is very difficult to answer without writing a manual. Let’s try and explore the specifics you mention below...

      Quote from: AHHP at Aug 23, 2008, 04:22 PM

      I started learning and working with MODx new version, I searched and read many tutorials and docs about it and it’s coding instruction.

      I found modx and xpdo documentations which introduce classes and details but couldn’t find bridges it means you explained all parts of a great system with details but there is no explanation about those philosophy. i really didn’t know how to join them for my purposes.

      I read splittingred’s blog, he has written about coding in Revolution but he hasn’t told anything about meaning of steps.
      Meaning and philosophy is subjective. Is that really what you are looking for? Meaning? I suppose the meaning is to improve the system, make it more maintainable, make it easier to customize without hacking, follow principles of object-oriented and pattern-based development, etc. Here is an old post that describes the motivations and design philosophy behind Revolution: http://modxcms.com/transforming-modx-oo-mvc-orm.html. Does that help?

      Quote from: AHHP at Aug 23, 2008, 04:22 PM

      Knowing previous version instruction is easier but Revolution is completely different.

      summary, I want to know what is the system of nested folders, in splittingred’s snippet creation tutorial i didn’t know why the plenty of folders need, why is it impossible to place all files in a few folders with simpler instruction.
      Yes, it’s completely different, yet very much the same. But which "system of nested folders" are you asking about? Are you asking about the component structure he exemplified for maintaining and building components in Subversion (SVN)? I’m not clear on what you mean, but if that’s the question, this is a new concept being demonstrated for those that want to build and maintain their components the way we have chosen to do so as part of the core team.

      Anyway, this is only necessary for building components you plan to distribute as transport packages, and includes details for things like providing localizations of strings used in your components. Otherwise, it’s business as usual, creating snippets, chunks, plugins, TV’s, templates, etc. Perhaps you should explore the familiar before you start trying to build complex components and taking advantage of all the new features. The major difference (besides the object-oriented API) in Revolution is the tag syntax and the improvements in the tag parser.

      Quote from: AHHP at Aug 23, 2008, 04:22 PM

      i want to know how MODx Revolution works, what is difference with it’s behavior with process documents in Revolution and previous versions?
      There are a number of differences, mostly afforded by the new object-oriented code that utilizes the xPDO foundation. The modResource class is the base class for any Resources (formerly Documents) that you will see in the manager tree, and can be extended to change the processing by supplying derivative classes. Are there specific questions about processing Resources you are looking for answers to? There is a lot to processing a Resource in Revolution and, as I said before, explaining all of it in detail would take a book. Let’s see if we can’t get this dialog focused on specific topics that are preventing you from understanding how it works enough to work with it.

      Cheers!
      • Thank you very very much. you are really OpenGeek! laugh

        I am very new in Revolution and i am not a professional PHP programmer (YET wink ).
        maybe more documentations and more experiments with new version help me to use and understand the really REVOLUTION you created! wink

        thanks again for your perfect and useful reply!
          God loves me. 【ツ】


          MODX.ir (Persian Support)

          Boplo.ir/modx/ (Persian)
        • Hi again,
          I decided to raise my knowledge about my Revolution problems with this topic and your knowledge grin , so please help me to solve and get more details about exist tutorial at least!

          I talking about creating MODx component in splittingred’s blog,

          What is SCHEMA?
          I found out that the schema creates a object to approach data of a DB table. so why should i use it? i can use select functions and get the table data too.
          I guess it allow me to get database data without no connecting to DB, so i don’t need connecting information and it can do anywhere. and i guess it can be more secure because connecting and dealing with DB do automatically with a separate script and it does not depend on my probably unsecured scripting. yes?


          and please tell me more about creating schema, how should i create it? why it extends (.e.g) xPDOSimpleObject?



          and would you tell me more about model folder which has created for a Revolution component and contains schema xml file, a class and etc.
          what is it exactly? why should it create?


          Thanks
          AHHP
            God loves me. 【ツ】


            MODX.ir (Persian Support)

            Boplo.ir/modx/ (Persian)
          • another problem,
            I confused to understand the structure of process, i see controllers, processors, connectors, template.
            the step of creating a component walk thorough this parts and i didn’t understand well.

            I found out that this parts connect them like image below:

            connectors connect to processors and controllers connect to processors & templates. and i lost the main step which I myself have been connected to controllers of connector.
            I saw in splittingred’s tutorial that there is a index.php file in some of this folders with a specific .php file and these two files attach together by "require_once, ...".

            index.php tells me that (for example for controllers folder), the address like ../controllers/ has been executed to run index.php and index.php which runs by MODx structure should call and run another specific .php file but in tutorial it is vice versa. index calls a class and call only by specific php file in controllers dir so if the index will run with another, why don’t i combine these two file in my specific php?
              God loves me. 【ツ】


              MODX.ir (Persian Support)

              Boplo.ir/modx/ (Persian)
            • Quote from: AHHP at Aug 24, 2008, 03:06 PM

              What is SCHEMA?
              I found out that the schema creates a object to approach data of a DB table. so why should i use it? i can use select functions and get the table data too.
              I guess it allow me to get database data without no connecting to DB, so i don’t need connecting information and it can do anywhere. and i guess it can be more secure because connecting and dealing with DB do automatically with a separate script and it does not depend on my probably unsecured scripting. yes?

              and please tell me more about creating schema, how should i create it? why it extends (.e.g) xPDOSimpleObject?

              and would you tell me more about model folder which has created for a Revolution component and contains schema xml file, a class and etc.
              what is it exactly? why should it create?
              This is all a part of xPDO, which Revolution is built upon. A schema is an XML file which defines a database table, it’s fields, it’s indexes, and it’s relationships with other database tables. It is used to generate domain and relational models of your tables that can instantly be used to manage the objects represented by the data. All xPDO objects are derived from xPDOObject and xPDOSimpleObject is a simple extension that automatically adds an id column with auto_incremented keys to an object (i.e. extend xPDOSimpleObject if your table will have a numeric primary key column, otherwise extend xPDOObject). xPDOObject provides methods to get() and set() the column values, save() the object to a row in the table, retrieve related objects, and a whole lot more. This is generically known as an Object/Relational Mapping framework, or O/RM.

              You can create a schema from an existing database/set of tables and/or generate a model (the classes and maps representing the tables in PHP) from that schema. If you make a change to a table, you can simply update the schema and regenerate the map describing the details of that table.
              • Thanks, i found out that SCHEMA is a feature for entering database data to an object system. you said i can update
                schema if i make change in my table but HOW? the schema ran in package installation how should i update existing object after installing it? ( i have unsuccessful experiment to install sample component in tutorial and i have nothing in model dir and IT causes this question! )

                and you talked about MODELs, you told model is a class and map to represent database tables in PHP. in existing
                tutorial about creating component, there is model directory which contains two php files: x.class.php and x.map.inc.php.

                does the x.class.php file contains the class which extended XPDOObject or XPDOSimpleObject in schema?
                what is contents of x.map.inc.php?
                are these files created by MODx and schema during component installation?

                is contents of model directory for ME? or it is needed only for MODx to represents data and use created object?

                is representing db-table data with creating object by schema, useful (or necessary) for any db-accessing in snippets and addons? or it’s needed only for components or some special addons?

                so if yes,
                if i want use a custom & simple snippet or addon which wants to connect DB tables via schema, should i install it only as a package to create object by schema? or can/should i create class and map of my object manually?

                and finally,
                How can i run (or use) schema manually for creating and/or updating my object? or probably all my thoughts are wrong and schema run (or use) only manually!! grin


                sorry for many questions!
                  God loves me. 【ツ】


                  MODX.ir (Persian Support)

                  Boplo.ir/modx/ (Persian)
                  • 34127
                  • 135 Posts
                  Quote from: AHHP at Aug 25, 2008, 06:43 PM

                  Thanks, i found out that SCHEMA is a feature for entering database data to an object system. you said i can update
                  schema if i make change in my table but HOW? the schema ran in package installation how should i update existing object after installing it? ( i have unsuccessful experiment to install sample component in tutorial and i have nothing in model dir and IT causes this question! )
                  I had the same problem at first. You need to make sure all of the paths are correct in your build/schema/build.x.php file (namely MODX_BASE_PATH and the path in the $modx->buildSchema call). Are there any errors after running the build file?

                  Quote from: AHHP at Aug 25, 2008, 06:43 PM

                  and you talked about MODELs, you told model is a class and map to represent database tables in PHP. in existing
                  tutorial about creating component, there is model directory which contains two php files: x.class.php and x.map.inc.php.

                  does the x.class.php file contains the class which extended XPDOObject or XPDOSimpleObject in schema?
                  what is contents of x.map.inc.php?
                  are these files created by MODx and schema during component installation?
                  The class file extends XPDOObject (or xPDOSimpleObject), and the map file contains the definition of your object (field size, type, name, attributes, etc). They are created (actually, transported) during the installation of a package.

                  Quote from: AHHP at Aug 25, 2008, 06:43 PM
                  is contents of model directory for ME? or it is needed only for MODx to represents data and use created object?

                  is representing db-table data with creating object by schema, useful (or necessary) for any db-accessing in snippets and addons? or it’s needed only for components or some special addons?
                  From what I understand, they’re required if you want to use xPDO in your projects (like the $modx->newQuery() and $modx->newObject() methods). You don’t *need* to use xPDO if you don’t want to, and instead you can use $modx->query() and $modx->prepare() with an SQL statement. One advantage of xPDO is the fact that xPDO escapes your data automatically, so there’s no need to worry about that part.

                  Quote from: AHHP at Aug 25, 2008, 06:43 PM
                  so if yes,
                  if i want use a custom & simple snippet or addon which wants to connect DB tables via schema, should i install it only as a package to create object by schema? or can/should i create class and map of my object manually?
                  I’m pretty sure there’s a way to generate a schema from a table definition, but personally I create it by hand (with a lot of copy and pasting). tongue It’s not completely necessary to use xPDO, or to even package your snippets - they’re run just fine as a stand-alone snippet. Packaging just makes it much easier to distribute your components to others. Even if you package your components, you *still* don’t need to use xPDO... for example, the WayFinder snippet doesn’t use xPDO yet, it uses $modx->query() instead. smiley

                  Quote from: AHHP at Aug 25, 2008, 06:43 PM
                  and finally,
                  How can i run (or use) schema manually for creating and/or updating my object? or probably all my thoughts are wrong and schema run (or use) only manually!! grin

                  sorry for many questions!
                  Most likely there’s a way to generate a table from a schema, much like there’s a way to generate a schema from a table, using xPDO, but I think one of the xPDO guys might need to comment further...
                  • Thank you alot! I learn many things about SCHEMA.

                    Quote from: Ricjustsaid at Aug 25, 2008, 09:23 PM

                    I had the same problem at first. You need to make sure all of the paths are correct in your build/schema/build.x.php file (namely MODX_BASE_PATH and the path in the $modx->buildSchema call). Are there any errors after running the build file?
                    I will ask and solve it in it’s main topic!


                    Would someone get me a instruction to create contexts for different domains? how should i do this?
                      God loves me. 【ツ】


                      MODX.ir (Persian Support)

                      Boplo.ir/modx/ (Persian)