We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25351
    • 6 Posts
    Hi all - hope this isn’t a repeat, couldn’t find anything with search.

    From what I can tell, all I can do in the ModX GUI is create a new template in which I can paste some HTML and other front end code. My problem is when I do this, I want to link to an external CSS file but I don’t know:
    a) Where to upload the CSS file or
    b) Where the template file goes when it’s created (in other words, I have no idea what the path TO the CSS file should be).

    Anyone have any clue?

    I assumed /assets/templates, but I don’t see the template file I created anywhere.

    Thanks SO MUCH for any advice!

    Iris*
      • 32070
      • 87 Posts
      You can actually put the CSS file anywhere you want! I typically create a new folder called styles in my MODx root where I upload my css files and usually any images that that I use in my design. I do this from my FTP app rather than in the MODx interface itself.

      Then in your template, you simply use standard HTML to point to the css file

      <link type="text/css" rel="stylesheet" href="http://www.yourdomain.com/styles/name-of-file.css" />


      Hope this answers the question.
        Des
        webandflowdesign.com
        • 23299
        • 1,161 Posts
        There is no one set way of doing this.

        I usually will build a static page first that points to my css and js files first. You can then copy the folder structure into the assets/templates folder like so: assets/templates/new_templateName/css/styles.css

        Then when you create your template from within MODx you make sure you point to the css file using that path in the head of your template. The css file can be placed anywhere but the path to that file must be perfect.
          • 25351
          • 6 Posts
          Thanks, @webandflow and @Photowebmax!

          I was trying to use a relative path to my files, but I suppose I may as well use a full URL, at least for now. Good call, both of you - I’ll give that a try and see if I can get things working logically - I’ll let you know.

          Thanks for the quick responses!
            • 4041
            • 788 Posts
            I think if you add the following to the <head> section of your template, the paths can be left relative (to the root index.php file). This also makes it easier to move from dev to production.

            <base href="[(site_url)]" /></base>
              xforum
              http://frsbuilders.net (under construction) forum for evolution
              • 25351
              • 6 Posts
              I went for the hard-coded path and it works, although it was a bit wonky because we’re working on an IP instead of a server situation and I don’t get that stuff. smiley

              I would still LOVE to know where ModX puts the template files that are created in the GUI, but I can get around it for now.

              Also, thanks @Breezer! I’ll try that as well!
                • 1169
                • 312 Posts
                To my knowledge template *files* are in the database.
                  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
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  The template created in the GUI is stored in the database in the site_templates table. Everything managed through the GUI, including resources and all elements, is stored in the database.
                    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