Struggling to Count Modules - Joomla! Forum - community, help and support


hi all.

believe me i've tried, can't index page count positions in way want. appreciated. nave 3 column template, left, content , right positions.

here's need:

if there's module enabled in 'left' , 'right' positions echo <some html>

else...

if there's module in left position echo <some other html>

else...

if there's module in right position echo <some other html>

else...

echo <one more bit of html>

the idea pages have left modules, pages have right, have both, might have none. want enable right/left/both/none appropriate , of course set centre div suitable width.

i can manage if i'm counting whether or not module exists in 1 place, multiple modules little brain.

cheers
steve

try following:

code: select all

$leftcount = ($this->countmodules('left'));
$rightcount = ($this->countmodules('right'));

if (($leftcount > 0) , ($rightcount > 0)) {
 echo '<div class=both>both left , right</div>';
} elseif ($leftcount > 0) {
 echo '<div class=leftonly>only left</div>';
} elseif ($rightcount > 0) {
 echo '<div class=rightonly>only right</div>';
} else {
 echo '<div class=noboth>no left , no right</div>';
}


i added divs completion sake - no real meaning in them.





Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support