We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41096
    • 7 Posts
    Hello guys!

    Admittingly, similar threads have been hiding quietly in the forum for quite some time; some are nearly 5~6 years old now. At the same time I believe that this is an issue that has always produced great interest, even back at the early days of Evo, but still has not been dealt with to an applicable extend.

    Many of us dream of utilizing the "MODX magic" as a web application framework. Knowing the potential of MODX as a CMS, we all know that the underlying framework and architecture can cope even with projects of the highest complexity.

    Now, at some point or another, we have all used the "typical" PHP App Frameworks like Codeignitor and CakePHP and we are familiar with their approach of applying the MVC concept, along with their given tools to build our App around them. At the same time, with MODX mainly exposing CMS related nuts and bolts, is does not make it easy for one to digest how to truly employ and further exploit it to deliver full-fledged Web App solutions.

    I, for one, (admitting that I probably rank below your average Joe developer) would really appreciate if someone of the MODX gurus would take the time to share with us the "official/de facto" way to approach this need. In practice, meaning how to express the MVC model through the overall MODX architecture, for a typical OO Web App that would produce a flexible and reasonably scalable result, equivalent to what one can produce with CI/Cake/... frameworks. Opengeek has repeadetly mentioned in older threads how MODX has already been providing solutions for Web Apps; so I am confident that at least a "best practice" approach has already been established.

    Typical questions that pop into my head range from simple stuff like the preferred code locality (snippet -vs- external) for best interoperability between MODX code and App code, all the way to major architectural issues like the details of implementing interaction between the MVC elements (via/part via the standard MODX CMS Tools -vs- via/part via the pure MODX/xPDO API) ...and obviously everything in between.

    I apologize for the somewhat lengthy post but I prefer to shamelessly reveal my ignorance, rather than to ignorantly look for happiness away from the MODX family. smiley


    I know that what I am asking could indeed require an even more lengthy responce (say about a whole chapter in the next MODX Official Guide from Bob), but I hope that someone will see the overall surplus for the MODX community and will get tempted to take this admittingly daunting subject to the next level.

    Thank you all for your time to read through and I look forward to hear from you.

    BR,
    GRE2608 [ed. note: gre2608 last edited this post 14 years ago.]
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      W. Shawn Wilkerson's book has a section on using MODx to build applications using the framework; my partner took off with it a couple of weeks ago and still hasn't brought it back, so I haven't been able to read all of it yet, but what I did was very good. A different point of view than BobRay's also excellent book; which is why I like to have at least two or three different authors for anything I'm studying, to get the different approaches and viewpoints.

      http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

      Donald Atkinson (fuzzicallogic), a recent convert to MODx, has been doing some remarkable work. An interview is here

      http://www.cmstricks.com/blog/2012/09/12/interview-donald-atkinson/

      and this is one of his projects, a front-end web-based IDE for MODx development (a case of using MODx to develop with MODx)

      https://forums.modx.com/thread/77735/ro-ides-editor-and-framework-for-modx-revolution-2-2

      His other project, AJAX Revolution, is another application using MODx itself to assist in developing AJAX-based applications.

      https://forums.modx.com/thread/79187/support-comments-for-ajax-revolution
      https://forums.modx.com/thread/78039/tutorial-create-seo-ajax-framework-revo-2

      The site he's developing using Revo is interesting in itself, if you pay attention to the actual URLs being used you can see that it's not just your average website.

      http://www.extendeddialog.com/
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 41096
        • 7 Posts
        Hello sottwell,

        I really appreciate your research for my question. Indeed there are some outstanding examples from people that have implemented WebApp related work with MODX, and surely MODX is up for the challenge.

        But, from where I stand, and I quote myself,
        ...admitting that I probably rank below your average Joe developer...
        I need to be able to see the WebApp Framework "forest" before focusing on any specific WebApp "trees".

        To be more clear, I am looking for the framework related concepts/principles/best practices of WebApp development - through MODX - and not so much, at this point, for specific implementations that, in a way, I have to reverse engineer in order to apply the provided know-how to my needs.

        I never forget that MODXs center of attention is website development, but I hope that with some guidance I'll be able to unlock the barriers in my head and efficiently exploit its full potential for all my WebApp development needs.

        Thank you again for your time and effort to help me.

        BR,
        GRE2608
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          Mark Hamstra Reply #4, 14 years ago
          Gee, with an infinite configuration engine as MODX, that's quite a question there!

          For framework-y aspects, you'll likely be looking most at the xPDO ORM/ORB that powers most in MODX. It's what you'll want to use to build database-agnostic and very flexible while still easy to read database queries in snippets/plugins. That's probably the biggest cornerstone right there, and there's some great resources in the RTFM for that:
          http://rtfm.modx.com/display/revolution20/Using+Custom+Database+Tables+in+your+3rd+Party+Components
          http://rtfm.modx.com/display/xPDO20/Creating+a+Model+With+xPDO

          So xPDO is your model, that's pretty much a given in most cases. Now, as to how to build your actual app.. there's many ways you could do that, all depending on your requirements on the work, technology or just general coding preferences.

          At MODX, we've built web applications in different ways as well...

          • One of them using resources and snippets in them as "controllers", with the accompanying template and chunks making up the "view". That's quite a rudimentary way, where basically the CMS backend becomes your tool for building the frontend app. Depending on how far you want to go with that, you could even build it in such a way that the client can configure options through template variables to change functionality or text within the app.
          • Some other tools/apps use a single "router" resource or plugin which quickly hands over processing to a custom router class, which loads in the proper controller based on the request, and lets the controller process whatever it needs to do and outputs that in the right view.

          These are just 2 ways of doing it that pop to mind, but I'm sure there's more people that do it quite differently. I just ordered Shawn's book today so am curious what he recommends.

          In the end, MODX provides you with the creative freedom to do whatever you want. If that means using xPDO for the model with resources, templates, snippets and chunks for the rest; or building out your own MVC based on xPDO bit; or only using MODX as an entry point or templateing engine for your custom built Symfony or CakePHP app; or using MODX as a CMS that contains data or information for your app that you sync through a simple JSON API, that's all up to you! Your imagination is the limit.
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 41096
            • 7 Posts
            Dear Mark,

            Thank you for your time to reply. It is now more clear to me and I think the conclusion goes down to something like this.

            Before everything else, one must examine carefully the task at hand; not only the present needs but also the potential future features that typically creep such a task.

            Respectively, for a typical single page web app, one could just as well use one of the existing frameworks and avoid the trouble altogether. But, if on the other hand, the project has a website to webapp ratio that rests heavier on the website side, it is totally worth exploring the use of MODX, either in itself or in combination with another app framework.

            Of course, what your post makes very obvious is that there are probably quite a few tones of grey that a given project might have, which might make this decision hard to make...

            Anyway, thanks once again, to both of you, for shedding your light on this issue.

            BR,
            GRE2608
              • 18373 ☆ A M B ☆
              • 3,141 Posts
              Mark Hamstra Reply #6, 14 years ago
              There's many ways to set things up, and there'll definitely be situations where a pure framework like Symfony, Laraval etc is better suited than MODX, and I definitely agree you have to look at what you got now and need in the future.

              That said, I don't entirely agree with...
              But, if on the other hand, the project has a website to webapp ratio that rests heavier on the website side
              ...being a requirement for an app in MODX to be a feasible option. In that case it definitely makes a lot of sense, but unlike your average CMS, MODX doesn't care about what a "resource" is to you. It just needs a title and content, and that content could definitely be a specific page in your app. That's not bad usage of the system and has its advantages (interface to manage ACLs with integrated user system, easy integration with existing tools etc).

              Coming from a hardcore developer perspective that might not make as much sense as a pure framework, but if budget or skills are tight, it could be a very interesting option to pursue, and might just make working together with designers who don't know code easier.

              Thank you for asking a very interesting question, do you have more like this? tongue
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.