We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8439
    • 89 Posts
    This seems kind of an obvious question but I have tried looking in the documentation and forums and can’t find clear guidance. So please, if there is a TFM, please point me at it. My question: where is the imported content of my site supposed to reside? I’m guessing somewhere in assets.

    Because I started with an existing site design from a web designer who is not yet house trained I began with a bunch of .html, .css and .jpg files. I wanted to retain the ability to use version control and external editors so I proceeded as follows.

    In the root of my site I copied the css and img directories and created my own templates as a number of .tmpi files, the .tmpi file contains what would otherwise go into the content of a modx template, i.e. xhtml and modx tags. For each modx template I created a snippet called templateInc which contains a php include(’template.tmpi’)) call, the modx template itself then simply consists of [[templateInc]]. I create documents from the template as usual.

    This works well but the css/, img/ and *.tmpi directories/files all reside within the root of the site.

    Q1: What is the modx way to structure this? should I move my css, img and *.tmpi to assets? (obviously editing the snippets) or should I create an assets/companyname directory and move them there?

    Q2: If I do this do I then need to include all css, php and javascript references to include directory structure, e.g. change @import url("css/sitewide.css"); to @import url("assets/companyname/css/sitewide.css"); or will modx take care of this for me if I set a configuration variable? [EDIT] looking in assets/templates I see stuff like [(base_url)]/assets/templates/companyname - this is fine for html/php and I’m guessing references within .css files are relative to the css directory

    Ed
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      There really is no "right way" to do that, MODx is infinitely flexible. However, to keep things organized, I put all tempate-related stuff (css files, tempate files, template-specific images and js files) in the /assets/templates folder, each template in its own folder. I put general js files in the assets/js folder, and images for documents get organized in the templates/images folder. But you can do whatever feels most comfortable for you.
        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