We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30284
    • 2 Posts
    I have just installed MODx, and I really like the feel of the system, even if I am quite inexperienced with CMS’s. One of the things I would like to experiment with is templates. Now, in the documentation on the page called "Template basics" there is a simple example of a template with two columns which is what I want.

    That page also include a suggestion for the contents of the "style.css" file, but not a word on where that file should go relative to the HTML file. Any suggestions?

    Tom
      • 4310
      • 2,310 Posts
      You can put it anywhere you like!
      Lots of people create a folder assets/templates/mytemplate
      and keep everything in there.
      In your template have
      <link rel="stylesheet" href="assets/templates/mytemplate/style.css" type="text/css" media="screen" />


      David
        • 30284
        • 2 Posts
        Thanks! And the template itself?

        Tom
          • 4310
          • 2,310 Posts
          Log into the Manager.
          Use the tabs - Resources => Manage Resources => Templates
          Then create a new template.
          When you create a new document you have a drop down to assign which template you want for that specific document.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            MODx does not limit your templates in any way. Tables, CSS, whichever doctype you prefer to use, location of supporting files (js, css, images) are all however you want to arrange them.
              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
              • 34017
              • 898 Posts
              This is how I setup my templates:

              First thing is create a snippet called ’templateInclude’
              <?php
              $theFile = isset($theFile) ? $theFile : 'temporary.html';
              $theFilePath = isset($theFilePath) ? $theFilePath : $modx->config['base_path'] . "assets/templates/YOURTEMPLATE/";
              
              if (file_exists($theFilePath . $theFile)) 
              {
              	include $theFilePath . $theFile;
              } else 
              {
              	echo 'File Not Available';
              }
              ?>
              


              Then I create a new template called ’default’ with the following code (this way you can edit the template in your favorite code editor:
              [[templateInclude? &theFile=`TEMPLATENAME_default.html`]]
              


              Then I create my css files in the /assets/css/ directory.
              JS goes into assets/js/directory.
              Images goes into /assets/images/ (or /assets/images/TEMPLATENAME/.

              I name my css files TEMPLATENAME.css, TEMPLATENAME_base.css, TEMPLATENAME_ie6.css, etc.

              and then in your template, you can call the files via:
              	<title>[*pagetitle*] | [(site_name)]</title>
              	<base href="[(site_url)]" />
              
              	<link rel="stylesheet" href="[(base_url)]assets/css/TEMPLATENAME.css" type="text/css" media="screen" />
              	<script src="[(base_url)]assets/js/YOURJAVASCRIPT.js" type="text/javascript"></script>
              


              This is just the way I do it. Some people use chunks and TVs (which makes sense if have different css/js per page).
                Chuck the Trukk
                ProWebscape.com :: Nashville-WebDesign.com
                - - - - - - - -
                What are TV's? Here's some info below.
                http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
                http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008