We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 813 ☆ A M B ☆
    • 326 Posts
    Here’s a good riddle for you:

    1. I have a template that contains 16 template variables (I’ve used ManagerManager to move them to their own tab, btw -- much less cluttered).
    2. All of the TVs spit out an identical wrapper div.
    3. The person creating a page with this template will always use at least one of the TVs, but they don’t have to use all of them.
    4. I want two columns on the page, but the data needs to flow down the page and split roughly halfway (i.e., it can’t just flow left-to-right using CSS floats on the divs).

    Now, the tricky part: How do I count the total number of TVs that have data in them, divide that number in half, and then put the first X number in the left column and the remaining X number in the right column (if it’s an odd number, I’d like the extra one in the left column)?

    I did find a snippet that does something similar with Ditto called DittoFormat (http://modxcms.com/forums/index.php/topic,38807.0.html), but because I’m calling TVs that are part of the same page and not repurposed Ditto content, I couldn’t make it work. Any ideas?

    Thanks!
      • 813 ☆ A M B ☆
      • 326 Posts
      The more I think about this, maybe Javascript is a better way to approach this? If so, has anyone used a good JQuery script for this that they could recommend?
        • 813 ☆ A M B ☆
        • 326 Posts
        Solved! I found a great JQuery snippet that does exactly what I need:

        http://welcome.totheinter.net/columnizer-jquery-plugin/