We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15745
    • 92 Posts
    If I want the home page layout different than content pages should I create two templates? One of the tutorials suggests that (http://net.tutsplus.com/tutorials/other/working-with-a-content-management-framework-modx/). I would like a two column set up on the homepage which I have and a signle column for the other pages. Here’s the homepage http://massflyfishing.com/cms/ I want to use the right coumn for upcoming events, testimonials, etc
      Version: 0.9.6.3
      North Shore Web Design
      • 5340
      • 1,624 Posts
      If you only have 2 templates for your website than go ahead and create another one.
      When you have more and something changes than you would have to do the change for all the templates. For 2 templates is easy. For 10 templates is harder smiley

      One solution would be to use chunks

      Template 1
      {{header}}
      {{content-home}}
      {{footer}}
      

      Template 2
      {{header}}
      {{content}}
      {{footer}}


      Another solution would be to have only 1 template and use phx
      {{header}}
      [+phx:if=`[*id*]`:is=`1`:then=`{{content-home}}`:else=`{{content}}`+]
      {{footer}}


        • 15745
        • 92 Posts
        Thank you Cipa,
        I am new to MODx so I don’t quite follow what you are saying.
        Here’s my html for the homepage
        <!-- start content area -->
            <div id="innerwrap">
                <div id="content"> <p>[*#content*]</p> </div>
                <div id="right"><p>right content here</p></div>
            </div>
           <!-- end content area -->

        I am able to add content in the main(left) area but what should I use in the right content. Should I create a ’chunk’? If so will this be editable for my client?
          Version: 0.9.6.3
          North Shore Web Design
          • 5340
          • 1,624 Posts
          2 questions

          1. What’s the difference between your home page and the other pages? I could guess that the right area will not be visible for the home page
          2. Will the right content be different for every page?

          Note: remove the p tag from main and right because TinyMce will do that for you.
            • 15745
            • 92 Posts
            2 questions

            1. Right contnet will only appear on the homepage (at this point)
            2. If there is right content on other pages it will be different

            as an aside, I don’t have the menu done but I have pages set up. How do I view them live - what’s the url? Would it be the id #
              Version: 0.9.6.3
              North Shore Web Design
              • 20413
              • 2,877 Posts
              See this related thread: http://modxcms.com/forums/index.php/topic,30777.0.html
              I did my first modx webpage with 5 templates, that page would only require one. If you are using the sitemap snippet its handy to
              exclude docs that are assigned to a certain template...

              ... http://www.csszengarden.com/
                @hawproductions | http://mrhaw.com/

                Infograph: MODX Advanced Install in 7 steps:
                http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                • 5340
                • 1,624 Posts
                In your case I would use 2 templates
                First create the 2 templates:

                Home will have

                <!-- start content area -->
                    <div id="innerwrap">
                        <div id="content">[*#content*]</div>
                        <div id="right">[*rightContent*]</div>
                    </div>
                <!-- end content area -->



                The second template will be

                <!-- start content area -->
                    <div id="innerwrap">
                        <div id="content"> <p>[*#content*]</p> </div>
                        
                    </div>
                   <!-- end content area -->



                For the home template create a TV called "rightContent":
                Variable Name: rightContent
                Caption: Right Content
                Input Type: Rich Text
                Save



                Make sure the Home page has assigned the home template. Another text box called Right Content should be available.
                Create a second page and assign the second template.


                If you want that all the pages be created using the second template go to Tools, Configuration and enter the second template id for "Site Start".
                If you do not have a menu you should have a look at wayfinder:
                http://www.muddydogpaws.com/development/wayfinder/examples.html



                  • 15745
                  • 92 Posts
                  Thank you - that’s a big help
                    Version: 0.9.6.3
                    North Shore Web Design
                    • 23571
                    • 223 Posts
                    One of the ways I have approached this is to use a snippet like the one below:
                    $TempId = $modx->documentObject['template'];
                    if ($TempId=="1")
                      $output="{{homeContent}}"; 
                    elseif ($TempId=="2")
                       $output="{{template2Content}}";
                    else
                       $output="{{template3Content}}";
                    return "$output";
                    

                    It allows you to call in different chunks based on which template is used. You can then use CSS to style the columns (even using a similiar snippet to call in different CSS). When I use this approach I get by with using the same HTML across multiple templates all of which are driven form a single source of HTML code.
                    The templates are not truly different, but you can hang different template variables and call ins on them.
                      • 15745
                      • 92 Posts
                      Thanks Greg. You’ve done a fantastic job on your site - is that MODx?
                        Version: 0.9.6.3
                        North Shore Web Design