We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    Create your template (two column, three column, whatever).  Next create chunks to contain the content (can be a snippet, or whatever you want) for the blocks to be inserted into the sidebars.  Create the following TV, and call it in the section of your template where you want these blocks to appear.  When editing a document, you will be able to select from the TV which blocks you want to appear on that web page.

    The TV:

    Variable Name:             SideBlocks
    Caption:                       SideBlocks
    Description:                  Content blocks for the sidebar
    Input type:                    Listbox (Mulit-Select)
    Input Option Values:      Menu=={{MenuBlock}}||Calender=={{CalenderBlock}} ...
    Default Value:               Menu=={{MenuBlock}}
    Widget:                        Delimited List
    Widget Properties:        Delimiter: <br />
    


    Give your template Template Access to the TV.

    In the Input Option Values enter the chunks/snippets you have created for your sideblocks, separating them with two upright bars ||

    The Default value is what will appear on every page (unless you specifically de-select it when editing the document).



    Here’s a sample chunk:

    <div class="sidebox">
      <div class="boxhead"><h2>[*pagetitle*]</h2></div>
      <div class="boxbody">[[MenuBuilder?id=0]]</div>
    </div>




    With CSS, this makes a nice sideblock with a header.  You can use this chunk to control the appearance of your sideblocks.  Here I used our own rthrash’s ThrashBox.  Screenshots below.  For now, you can see it at http://www.sottwell.com.


      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 33337
      • 3,975 Posts
      Zaigham (aka zi) Reply #2, 21 years ago
      That’s a great tutorial !!!

      Thanks for sharing !

      regards,

      zi
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 18397
        • 3,250 Posts
        MARKSVIRTUALDESK Reply #3, 21 years ago
        Ditto. Thanks!
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          For a three-column template, I "duplicated" the TV, gave it a different name (LeftSideBlocks) and called it in the left sideblock <div>. Now each page has two drop-downs, with the same options, and I can mix and match the sideblocks on the left or the right as I please.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 32963
            • 1,732 Posts
            Perfect! wink
              xWisdom
              www.xwisdomhtml.com
              The fear of the Lord is the beginning of wisdom:
              MODx Co-Founder - Create and do more with less.
              • 4266
              • 70 Posts
              Can I change the order of the sideblocks?

              Very usefull tip - THANK you  laugh
              Looking forward to see your new smart tutorial!
                • 25663 MODX Staff
                • 12,272 Posts
                bugaev, I was wondering the same exact thing. If someone could figure that out, it’d be really cool. smiley
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 1764
                  • 680 Posts
                  Quote from: bugaev at Sep 09, 2005, 07:20 AM

                  Can I change the order of the sideblocks?

                  One way to get it done is to create multiple TVs as dopdown lists (Block 1, Block 2, Block 3, etc.) then you can choose which one you’d like in which positon. It’s a bit more work but not too bad as long as you store the block list separately in a chunk or something and link to it via the TV’s Input Option Values. Otherwise you’d have to change every TV every time you added or deleted a block.

                  P.S. Checkboxes can also be used in place of listboxes. I find that this tends to be a bit more user friendly for those who don’t know to hold down Ctrl to multi select lists.
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    As soon as I get the chance I’m going to look at the checkbox method; this was really just a quick-and-dirty way of doing it. There should be some way of making up an entire module for handling blocks like this; it’s something I shall think on for a while (unless, of course, somebody else does it first!)

                    As it is now, the only way (afik) to change the order is to rewrite the Input Option Values for the TV. Even so, it’s better than making different templates for every page!
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 25663 MODX Staff
                      • 12,272 Posts
                      I see what you mean Adam: assign an arbitrary number of "blocks" for each column, and link a pop-up list of chunks per Susan’s hint. It takes one TV for each "block position". If you don’t choose a block chunk, it doesn’t add anything to the slot.

                      This might just become the basis for an "Emulating the *Nukes with MODx" tutorial.
                        Ryan Thrash, MODX Co-Founder
                        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me