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

    I’m working on my first application of modx, and I’ve become a little confused with something that has to be a very basic aspect of modx and her templates.

    My main site template involves a pretty basic three-column layout, which most of my pages will use. But on hundreds of my site’s other pages, I have to modify the format by removing the right column, expanding the width of the middle column and adding adsense blocks. And of course, I’ll need the ability to modify these hundreds of pages separately from the site’s other pages, and by changing one document, just like with a separate template.

    From this forum’s experienced modx users, is it best/easiest to just set up two templates, or should I use template variables for this? Or something else entirely? I’m trying to start off doing this the right way, instead of just doing what looks easiest at my current level of (in)competence.

    Thanks for any assistance!

    Cris
      • 4172
      • 5,888 Posts
      I think, most times its better to have seperate templates for different page-layouts. For parts which are the same on both layouts you can use chunks and
      put them in your templates for example like this.

      {{doctype}}
      <html>
      {{head}}
      <body>
      {{header}}
      <div id="pagecontent">
      {{left_column}}
      {{middle_column_A}}
      {{right_column}}
      </div>
      {{footer}}
      </body>
      </html>
      


      another way or in combination you can go is create checkbox-TVs with input-option-values as:
      show middle column A=={{middle_column_A}}||show middle column B=={{middle_column_B}}||show right column=={{right_column}}


      and you can add textarea-tvs for parts, which may change from parent to parent and make use of @INHERIT-Binding as default-value.
      if you want to change only the width of one column you can create a radio-tv for different CSS-classes with input-option-values:
      small||wide

      or if you have two different templates use the template-id for changing CSS-classnames. For example class="middle_[*template*]".

      ..................

        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!