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
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:
i added divs completion sake - no real meaning in them.
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
Post a Comment