title: How to structure a master page with coldfusion?
body: <p>I have a small coldfusion section of our site that all uses similar js and css files and page structure. The code is currently repeated for each file, and I'd like to factor it out and set something up using a master page and templates.</p>
  
  <p>Master.cfm page:</p>
  
  <pre><code>&lt;!--- Master template, includes all necessary js and css files. 
      Expects following variables to be defined:
      - pageName - name of the file to be loaded as the body of the page 
      - title - text to be used as the title of the page and as the header text in the header bar ---&gt;
  &lt;cfinclude template="_lockedPage.cfm" /&gt;
  
  &lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
          &lt;title&gt;#title#&lt;/title&gt;
          ... all script and css links here ...
          &lt;script type="text/javascript" src="js/jquery-1.9.1.min.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="js/jquery.mobile-1.3.2.js"&gt;&lt;/script&gt;
          ... etc ...
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div data-role="page"&gt;
              &lt;div class="headerDiv" data-role="header" data-theme="b" data-position="fixed"&gt;
                  &lt;a id="backButton" data-role="button" data-direction="reverse" data-rel="back" data-icon="arrow-l" data-iconpos="left" data-theme="a"&gt;Back&lt;/a&gt;
                  &lt;h1&gt;&lt;cfoutput&gt;#title#&lt;/cfoutput&gt;&lt;/h1&gt;
                  &lt;a href="index.cfm" data-role="button" data-icon="home" data-iconpos="left" data-theme="a"&gt;Home&lt;/a&gt;
              &lt;/div&gt;
              &lt;div data-role="content" class="container"&gt;
                  &lt;cfinclude template="#pageName#.cfm" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Then a page example would be something like this. CustomerSearch.cfm:</p>
  
  <pre><code>&lt;cfscript&gt;
      title = "Customer Search";
      pageName = "_customer-search";
      include "Master.cfm";
  &lt;/cfscript&gt;
  </code></pre>
  
  <p>And then I would need a _customer-search.cfm page that would include all the body content for the page.</p>
  
  <p>This means that I would need 2 files for every page that we currently have - the outer page that defines the variable and includes the master page, and the template page that has the individual page content.</p>
  
  <p>Is this a good logical structure? Is there anyway to improve it?</p>