0
Welcome Guest! Login
0 items Join Now

Custom Module Positions

    • Vikram Rao's Avatar
    • Vikram Rao
    • Rocketeer
    • Posts: 93
    • Thanks: 0
    • Consultant

    Custom Module Positions

    Posted 13 years 6 months ago
    • Hi !

      I modified the 'body_mainbody.php' file and added a custom layout which I want to implement on a specific Menu ID.

      Unlike the standard 960gs, I want to implement module positions like the standard Joomla collapsible modules with equal width.

      Kindly help.

      Example:

      The XHTML

       
      <?php
      $user_count = ($doc->countModules('user-1')>0) + ($doc->countModules('user-2')>0) + ($doc->countModules('user-3')>0) + ($doc->countModules('user-4')>0) + ($doc->countModules('user-5)>0) + ($doc->countModules('user-6')>0);
      $user_width = $user_count > 0 ? ' w' . floor(99 / $user_count) : '';
      ?>
       
      <?php if ($this->countModules('user-1 or user-2 or user--3 or user-4 or user--5 or user-6')) { ?>
          <div id="user-modules">
              <div class="spacer<?php echo $user_width; ?>">
                  <jdoc:include type="modules" name="user--1" style="jxhtml" />
                  <jdoc:include type="modules" name="user--2" style="xhtml" />
                  <jdoc:include type="modules" name="user--3" style="xhtml" />
                  <jdoc:include type="modules" name="user--4" style="xhtml" />
                  <jdoc:include type="modules" name="user--5" style="xhtml" />
                  <jdoc:include type="modules" name="user--6" style="xhtml" />
              </div>
          </div>
      <?php } ?>
       

      The CSS
       
      #user-modules {width:960px; margin:0 auto;}
      .spacer .module {float: left;}
      .spacer.w99 .module {width: 100%;}
      .spacer.w49 .module {width: 50%;}
      .spacer.w33 .module {width: 33.33%;}
      .spacer.w24 .module {width: 25%;}
      .spacer.w19 .module {width: 20%;}
      .spacer.w16 .module {width: 16.66%;}
       
    • Vikram Rao
      http://www.vikramrao.com

Time to create page: 0.033 seconds