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

    I was thinking about the directory-structure of modx, because I want to insert the files necessary for my snippets into the "well-proven" and given structure. How should I do this? Where to put things like sources to highlight, additional php-files and stuff?
    Also, where is the code of a snippet stored? In the database or in a file? I don’t like the online-editor and want to edit my files directly on the server (or test-server).
    Would be nice if anyone could give me advise and explain the directory structure of modx.

    Thanks in advance,
    bll0

    P.S. I’m not sure if this is the correct subforum for my question, so, mods feel free to move it around.
    • Hi bll0,

      For all snippets that are added from within the Manager, the code is stored in the database - the good news is that you can run off external files easily.

      For information on how to set up snippets to run from the external files, xwisdom published a great tip in this post.

      In terms of directory structure, for snippets/modules/plugins that require external php files, the directory structure is as follows:

      /root of website
      |
      |_/assets
        |
        |_/snippets
          |
          |_/mysnippet
        |
        |_/modules
          |
          |_/mymodule
        |
        |_/plugins
          |
          |_/myplugin
      

      Under each of your custom folders, you could break the directory structure down even further if you wanted but that is really down to personal preference. For example, you could have folders based on the type of file: css/js/includes/images etc.

      Hope that helps, Garry

        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com