Joomla!
http://forum.joomla.org/

FAQ: How do I collapse an empty position in a template?
http://forum.joomla.org/viewtopic.php?f=414&t=95197
Page 1 of 1

Author:  leolam [ Fri Sep 15, 2006 2:07 am ]
Post subject:  FAQ: How do I collapse an empty position in a template?

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:
      <div id="left_outer">
                      <div id="left_inner">
                      <?php mosLoadModules ( 'left', -2 ); ?>
                      </div>
                  </div>
                  <div id="content_outer">

with this :
Code:
      <?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:
#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

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/