I'm using grid layout and I need to calculate column width depending on amount of active modules in a position. I'm assigning the css class within my module chrome.
What I was doing till now was something like this:
$position1ColumnWidth = functionThatCalculatesWidth('position1');
...
<jdoc:include type="modules" name="menu" style="customChrome" colWidth="<?php echo $position1ColumnWidth?>"/>
And than in modules.php
I'd do something like this:
function modChrome_customChrome ($module, &$params, &$attribs) {
echo "<div class=\"" . $attribs["colWidth"] . ">";
echo $module->content;
echo "</div>";
}
This way seems dirty to me because I have to calculate column width in my index php and it adds unnecessary code if I'd like to add a new position.
Is there a way to access countModules function for position that is currently rendered from within module chrome to separate logic from template as much as possible?