Templates

How To Add a Template to MODX

light fare

Adding Templates

So you've downloaded one of the multitude of website templates available on the Internet. Now what do you do with it?

agphys asked...

How do I add templates to my modx? There's 1 file (index.html) and a default dir which contains a css file and a js file. But to where, exactly, should I upload these files? Im using Filezilla.

... i still dont know where to put the css and js files that came with the template download.

The Solution

dan says...

Adding new templates

You don't upload templates to MODX, you create them inside the manager, or paste them into the manager.

Have a look here for a basic MODX overview: http://codingpad.maryspad.com/beginner-tutorials/

...Create a folder and upload them via the Files tab or upload them via FTP as you would normally do. Or make a new resource in MODX and set the Content Type to CSS or javascript if you want to dynamically link to them as you would other MODX resources with [[~id]]

What's the Story?

MODX templates are stored in the database, so the HTML is entered in the Template Code field in the New Template form. Accompanying support files, such as .css, .js or image files, are stored in the site's file system, usually in the /assets directory somewhere. The template needs to be edited to make sure the links to these files are pointing to the correct location where you put them.

Of course, this being MODX, there are a number of alternatives to this, such as using a static template or using resources for the .css and .js assets, but basically that's all there is to it.