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

    I’m new to MODx, but am quite impressed with its power and flexibility. There’s only one caveat, and I’m hoping it’s just because I don’t know any better.

    I’m a frontend dev, and I’m used to building websites of all sizes. But I usually work with files and version control. How would I keep this paradigm with MODx?

    From my poking around so far, the only way I found to use an IDE, is to keep static files with my code, to later on copy/paste into MODx Manager. Far from ideal.

    I’m aware that a lot of people use an "include" snippet, to include snippets, chunks, etc. Does this work for MODx specific tags? For example, if I include a file as a snippet, and I have a template variable defined in there (or a resource link), would that be properly rendered?

    Also, is there a performance hit using a snippet by including a file, vs having the snippet code entered into MODx Manager?

    Bottom line, how do you develop sites on MODx? Where do you enter your code? Is there a feature like the "Import HTML" but for snippets and chunks? Is there a way to create new Templates, Documents, Chunks, TVs, etc. without going through the Manager?

    Thanks in advance!
      • 1169
      • 312 Posts
      Hi @real and WELCOME to MODX

      There is no 1 line answer to your question.
      MODX at present is designed as a Database System.

      It is possible to use a file based system(not recommended for production) on a local dev server. It works well while developing the system and works for chunks, snippets, templates basically elements in MODX. You can use any IDE or Editor you choose on these files
      As you stated you can use an include snippet that loads the required file from any folder you chose MODX does not dictate how you organise you files.
      These files can be a git repo if you require version control.

      On a dev server performance it not usually a problem.
      I have had no problems with MODX tags and TV’s as the code still goes through the parser.
      To move from dev to production the file contents can be pasted into the MODX manager in place of the include snippet call.

      I only tend to use this method while working on a new template or new concepts I don’t understand.

      Hope this helps.
        DEVELOPMENT ENV:- Ubuntu 12.04 | MODx Revolution 2.2.8 | LAMP 2i Apache 2.2.22 | Php 5.3.10 | Mysql 5.5.31 MySQL client version: 5.5.31
        • 35804
        • 2 Posts
        I see, I guess I’ll have to adjust my workflow then. Thanks!
          • 3749
          • 24,544 Posts
          If you use OOP and put most of the functionality in the class file, the snippet can be very short and can "include" or "require" the class file. Most of your work will be on the class file, so it can be done in your favorite editor.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting