Monday, April 30, 2012

Create collapsible content area in joomla


open selected template index.php file and put below code where you want to collapse div.

<div id="content">
     <?php if($this->countModules('content_right')) : ?>
       <div id="content_left"><jdoc:include type="message" /><jdoc:include type="component" /></div>
     <?php elseif(!$this->countModules(' content_right ')) : ?>
       <div id="content_full"><jdoc:include type="message" /><jdoc:include type="component" /></div>
     <?php endif; ?>



     <?php if($this->countModules('content_right')) : ?>
       <div id="content_right"><jdoc:include type="modules" name="content_right" style="rounded" />        </div>
     <?php endif; ?>
</div>


in above sample content_right is a optional part of the content area.
If content_right is exist on the page then content content_left will be created.
and  when content_right in not exist then content_full will be generated as a content area.

Apply css to get more idea .

<style>
     #content{width:100%;overflow:hidden;}
     #content_left{float:left;width:70%;}
     #content_full{width:100%;}
     #content_right{float:right; width:28%;}
</style>

Cheers...

No comments:

Post a Comment