tags:

views:

44

answers:

1

I'm creating a Joomla 1.5 Template based in 960 grid system. Now I'm having a problem with my modules. What is the best practice to control the width and how you display modules?

Here's the scenario, in my footer I have 4 box (which will be my Joomla modules and each module has a width of '220px' with a margin of '10' in each side).

The Problem If I only have less than 4 boxes (modules) it creates a gap in my layout. I want my layout to be able to display in full w/ no gaps. For example if I only got 2 boxes/module in my footer they would divide the '940px' width (960px-10px margin) and they would be have '460px'of width each.

I am also confuse how I will do the CSS if I will use an 'ID' or 'Class' to control the structure (eg. #Footer #Module1 {width 240px;} or #Footer .module-grid4 { width: 240} )

I think the correctway would be using a PHP condition for the modules and would be applying a class to each layout.

If you're in my shoes how would you do it? Please advice.

Thanks!

+1  A: 

I'm not sure about the CSS specifics, but you can count the number of modules assigned to a specific position this way:

<?php if ($this->countModules('footer') < 4): ?>
    // less than four modules markup here
<?php else: ?>
    // normal markup here
<?php endif ?>

You might have <div> tags with different IDs for the different layouts (three modules, four modules, etc...) which you could then style through CSS.

jlleblanc