FAQ: How do I collapse an empty position in a template?

This is the archive off all FAQ related threads.
Locked
User avatar
leolam
Joomla! Master
Joomla! Master
Posts: 19530
Joined: Mon Aug 29, 2005 10:17 am
Location: Netherlands/ UK/ S'pore/Jakarta/ North America
Contact:

FAQ: How do I collapse an empty position in a template?

Post by leolam » Fri Sep 15, 2006 2:07 am

Very often the question is asked on how to collapse a position in any template. Note collapse here means "not show" if no modules are published to these columns.............

Here is a method on how to do this as an example with the tremendous popular rhuk_solarflare template:

open ../templates/rhuk_solarflare_ii/index.php and find and replace this:

Code: Select all

      <div id="left_outer">
                      <div id="left_inner">
                      <?php mosLoadModules ( 'left', -2 ); ?>
                      </div>
                  </div>
                  <div id="content_outer">
with this :

Code: Select all

      <?php
                    if ( !(mosCountModules( 'left' )) ) {
                  ?>
                  <div id="content_outer2">
                  <?
                    }
                    else {
                    ?>
                  <div id="left_outer">
                      <div id="left_inner">
                      <?php mosLoadModules ( 'left', -2 ); ?>
                      </div>
                  </div>
                  <div id="content_outer">
                  <?
                  }
?>
and save the file.

then open ../templates/rhuk_solarflare_ii/css/template_css.css file add this: and add

Code: Select all

#content_outer2 {
    padding: 0px;
    margin-top: 0px;
    margin-left: 0px;
    /** border: 1px solid #cccccc; **/
    float: left;
    width: 800px;
}
save and your left column now will collapse when you don't publish anything to it!

This method you can multiply to any template if you try to follow the logic of the code!

cheers  ;)
Leo
Last edited by mcsmom on Mon Oct 16, 2006 11:02 am, edited 1 time in total.
Joomla's #1 Professional Support Provider:
-> Joomla Professional Support: https://gws-desk.com -
-> Joomla Specialized Hosting Solutions: https://gws-host.com -
-> Joomla Webmaster Services: gws-webmaster.services

Locked

Return to “FAQ Archive”