Module Position in Joomla

Load One Module Position

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

Load Four Module Positions

 
<?php if ($this->countModules('user1 or user2 or user3 or user4')) : ?>
<div id="userModules">
 
  <?php if ($this->countModules('user1')) : ?>
  <div id="user1">
    <jdoc:include type="modules" name="user1" style="xhtml" />
  </div><!-- end user1 -->
  <?php endif; ?>
 
  <?php if ($this->countModules('user2')) : ?>
  <div id="user2">
    <jdoc:include type="modules" name="user2" style="xhtml" />
  </div><!-- end user2 -->
  <?php endif; ?>
 
  <?php if ($this->countModules('user3')) : ?>
  <div id="user3">
    <jdoc:include type="modules" name="user3" style="xhtml" />
  </div><!-- end user4 -->
  <?php endif; ?>
 
  <?php if ($this->countModules('user4')) : ?>
  <div id="user4">
    <jdoc:include type="modules" name="user4" style="xhtml" />
  </div><!-- end user5 -->
  <?php endif; ?>
 
</div>
<?php endif; ?>
 

3-Column Class Conditionals

 
//Put in Head section
 
  <?php 
  if($this->countModules('left and right') == 0) $contentwidth = "full";
  if($this->countModules('left or right') == 1) $contentwidth = "single";
  if($this->countModules('left and right') == 1) $contentwidth = "both";
  ?>
 
//Then put in Body
 
<div id="middleCol" class="<?php echo $contentwidth ?>">
 
//Then put in CSS
 
#middleCol.full {width: 100%;}
#middleCol.both {float: left; width: 50%;}
#middleCol.single {float: left; width: 75%;}
 

Comments

Popular posts from this blog

PHP: Date Difference for PHP 5.2

HTML5 video loop src change on end play function

Custom OpenCart 2.3.0.2 theme