We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3483
    • 6 Posts
    I have a template with four columns, each filled with content by different chunks. This offcourse works for page A, but I also want to use this template for page B, filling the columns with other content.

    What is the best solution here? Do I duplicate my template and refer to different chunks or is there another option so that I can chance the content within the columns without changing of template (perhaps not using chunks...?)

    Please let me know your suggestions and tips, thanks in advance!
      • 3749
      • 24,544 Posts
      Hi BKA,

      It’s best to avoid multiple templates if you can. It makes maintenance a lot easier. You shouldn’t need them for this situation.

      There is more than one way to solve your problem, but this is probably the simplest.

      1. Create 4 template variables, one for each of the four columns and be sure they’re attached to your main template. Give them names that will remind you which is which. Use the default input and output types but set the default value to @CHUNK so you don’t have to type it every time.

      2. In the template, put the appropriate TV tag in each column, like this:
      [[*column4]]


      3. Create chunks (not chucks wink ) for each of the four sections and note their names.

      4. Go to each page that uses the template and fill in the name of the appropriate chunk after the @CHUNK in each TV:

      Template Variables

      Column One: @CHUNK column1
      Column Two: @CHUNK column2
      Column Three: @CHUNK column3
      Column Four: @CHUNK column4

      Every new page that uses that template will have the four template variables showing when you edit the page and you can assign any chunk to any TV to put what you want on each page.

      Hope this makes sense. smiley
        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
        • 3483
        • 6 Posts
        Hey Bob,

        That makes perfect sense, thanks for that!

        Gives me a much better understanding of template variables (that name suddenly makes sense rolleyes) and the possibilities within!

        Thanks again, case closed...