We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37437
    • 147 Posts
    I just installed MODx and have started the process of creating my own template. Following along with the Creating Unique Templates For Your Site documentation, I clicked on New Template in Manage Resources, added the template’s basic xhtml, and then saved the code. I then wanted to assign a stylesheet to the template. Although the documentation clearly indicates that a css stylesheet needs to be associated with the template, it does not seem to provide any directive as to how the css file should be created or where it needs to be placed. Do you create a CSS file outside of the MODx framework and then just manually upload it to a specific directory (and if so, which one)? Do you use the MODx interface (much as it is used to create the initial template file) to post the CSS styles?

    Any advice would be greatly appreciated as the MODx documentation seems to be lacking in the important details here.

    Thank you very much.
      • 1343 ☆ A M B ☆
      • 2,213 Posts
      Hello,

      Create a folder in /assets/templates/TEMPLATENAME/xxxxxxx

      You can save all your template resources in this folder. If you’re not familier with creating templates and such there is a great collection of ready to go templates in the repository (click resource tab in top right)

      AMDbuilder
        Patrick | Server Wrangler
        About Me: Website | Tweets |  MODX Hosting
        • 25663 MODX Staff
        • 12,272 Posts
        Marconi, forget everything you know about other CMSes. There’s litereally several ways to reach the same end goal. You can make your CSS be a document, which opens up interesting things programatically. That’s probably a bit advanced for starting out though.

        You can also just stick it on the filesystem, which is what I do 99/100 times. Typically I’ll put my "site.css" files at the top level of the assets directory, so that getting to any images can be done with succinct code:
        #foo { background: url(images/bar.jpg) no-repeat 50% 50% }


        Then in my templates I stick this at the top of my head section immediately after my title tag and any meta content:
            <base href="[(site_url)]"></base>
            <link rel="stylesheet" type="text/css" href="assets/base.css" />
            <link rel="stylesheet" type="text/css" href="assets/site.css" />


        The "base.css" file is your typical reset similar to what Eric Myers recommends. The reason I don’t like to use the templates folder is that it just sticks everything yet another level deeper in the filesystem and I’m a lazy typer. wink
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 1343 ☆ A M B ☆
          • 2,213 Posts
          You should just start marketing MODx as the Photoshop of the web! 9 Million ways to accomplish anything and not a wrong way yet! Granted that would require price disclaimer...

          AMDbuilder

            Patrick | Server Wrangler
            About Me: Website | Tweets |  MODX Hosting
            • 37437
            • 147 Posts
            Thanks a lot for the help, folks. Following the various suggestions that were made to this posting, I did manage to create a template with the proper css association. Rthrash was right -- you really have to leave behind a lot of the development habits you pick up from using other CMSs. I still have a long way to go with MODx, but I am definitely appreciating the freedoms that the system offers.
              • 23299
              • 1,161 Posts
              Yes!
              Being in charge of the CSS and having some freedom is what tipped the scales in MODx’s favor when i was evaluating CMS systems...

              Max
                • 37437
                • 147 Posts
                Max -

                Indeed, with every passing day I grow to appreciate MODx more and more. This is, without question, the cleanest and most elegant CMS I have test driven. It is now my product of choice and I certainly hope that it is here to say.

                Three cheers for MODx and the development team that supports it!

                Marconi