We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28404
    • 3 Posts
    Hi,

    I want to build a site which has two nearly same layouts, the only different is that one layout have a header title segment and the other do not. The two layouts like:
    layout1:
    <br /><html><br />  <body><br />     ...<br />     <div id="content_box_left"><br />      ...<br />     </div><br />     ...<br />  </body><br /></html><br />

    layout2:
    <br /><html><br />  <body><br />     ...<br />     <div id="content_box_left"><br />       <div id="body_header">...</div><br />       <div id="body_contents">...</div><br />     </div><br />     ...<br />  </body><br /></html><br />

    If I choose layout1 as the template, I have to put the <div id="body_header"> and <div id="body_contents"> into the resource content of every page which has layout2 layout. This seems not good. Do I have to create two templates, one is for layout1, the other is for layout2, but they are nearly same?
      • 3749
      • 24,544 Posts
      One way to go is to use one template, but two different CSS files to control the layout and put the path to the CSS file in a template variable.

      Another way would be to put the header title stuff in a chunk and use a template variable to determine whether the chunk is included or not.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting