We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28495
    • 17 Posts
    I’m working on site that really needs to have sidebars displayed conditionally - and not all of them are for menus.

    Ideally each document would do something like:

    <body class="no-sidebars">

    <body class="two-sidebars">

    <body class="three-sidebars">

    etc.

    Anyone every had to do this? Can I call a snippet or chunk that would do this for me?

      ------------------------
      Stephen White
      Cofounder
      Zemelo Corporation
      [email protected]
      • 4041
      • 788 Posts
      You could do this with a Template Variable quite easily.

      Create a new TV (for this example it’s named bodyclass)
      Fill out the description and caption fields if needed.
      Input Type: DropDown List Menu
      Input Option Values: No Sidebars==no-sidebars||2 Sidebars==two-sidebars||3 Sidebars==three-sidebars
      Default Value: No Sidebars (if left empty it will use the first in the above option values list)
      Make sure you check the template(s) you want this TV available to.

      Open your template(s) and add this: <body class="[*bodyclass*]">

      Now for every document that uses this template variable, there will be a dropdown list of the classes which you can choose from.

      Hope this helps smiley
        xforum
        http://frsbuilders.net (under construction) forum for evolution
        • 28495
        • 17 Posts
        I’ll give it a shot - looks easy! Thanks!
          ------------------------
          Stephen White
          Cofounder
          Zemelo Corporation
          [email protected]
          • 28495
          • 17 Posts
          cool!

          For some reason I had it in my head TVs were for storing and displaying user input...

          This is great - now I can create a liquid content area and have the sidebars pop in and out as needed. Cheers, where do I ship the beer to? cool
            ------------------------
            Stephen White
            Cofounder
            Zemelo Corporation
            [email protected]
            • 11468
            • 20 Posts
            Hey this is great to find this - I’ve been looking for a solution to this! Thanks SO much from me too laugh
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              I’ve used something similar as an example of using radio button TVs

              http://www.sottwell.com/tv-input-types.html
                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
                • 989
                • 3 Posts
                Yes...it’s great. And really similar. Maybe I’ll try to do this on my web