treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Collpsible Module Positions

  • Hi I am building a template for my site which is using Joomla. I was wordering if someone can help me with making module positions collapsible.

    I mean, I create 5 module positions namely box1, box2, box3, box4 and box5.

    All these boxes are in a horizontal line next to each other, in the same row.

    Lets say if I publish modules only in box1, box2 and box3. the other two (box4 and box5 must collapse) and these three published boxes should spread to the entire row’s width.

    In short all unpublished positions must collpse and the published positions must stretch to the row’s width.
  • here's the sample code:

    <?php if( ($this->countModules('box1') || ($this->countModules('box2') ||($this->countModules('box3') || ($this->countModules('box4') ): ?>
    <!-- BEGIN: BOTTOM BOX -->
    <div id=\"box-group\">
    <?php if( $this->countModules('box1') ): ?>
    <div class=\"box\">
    <jdoc:include type=\"modules\" name=\"user1\" style=\"xhtml\" />
    </div>
    <?php endif; ?>

    <?php if( $this->countModules('box2') ): ?>
    <div class=\"box\">
    <jdoc:include type=\"modules\" name=\"user2\" style=\"xhtml\" />
    </div>
    <?php endif; ?>

    <?php if( $this->countModules('box3') ): ?>
    <div class=\"box\">
    <jdoc:include type=\"modules\" name=\"top\" style=\"xhtml\" />
    </div>
    <?php endif; ?>

    <?php if( $this->countModules('box4') ): ?>
    <div class=\"box\">
    <jdoc:include type=\"modules\" name=\"user5\" style=\"xhtml\" />
    </div>
    <?php endif; ?>
    </div>
    <!-- END: BOTTOM BOX -->
    <?php endif; ?>