test

Php code posted
created at 16 Oct 17:47

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
switch (count($modules)) {
  case 1:                                                                     // 100%
    printf('<div class="grid-box width100 grid-h">%s</div>', $modules[0]); 
    break;
  case 2:                                                                     // 66% - 33%
    printf('<div class="grid-box width66 grid-h">%s</div>', $modules[0]); 
    printf('<div class="grid-box width33 grid-h">%s</div>', $modules[1]);
    break;
  case 3:                                                                     // 50% - 25% - 25%
    printf('<div class="grid-box width50 grid-h">%s</div>', $modules[0]); 
    printf('<div class="grid-box width25 grid-h">%s</div>', $modules[1]);
    printf('<div class="grid-box width25 grid-h">%s</div>', $modules[2]);
    break;
  case 4:                                                                     // 40% - 20% - 20% - 20%
    printf('<div class="grid-box width40 grid-h">%s</div>', $modules[0]);
    printf('<div class="grid-box width20 grid-h">%s</div>', $modules[1]);
    printf('<div class="grid-box width20 grid-h">%s</div>', $modules[2]);
    printf('<div class="grid-box width20 grid-h">%s</div>', $modules[3]);
    break;  
  default:
    echo '<div class="grid-box width100 grid-h">Error: Only up to 4 modules are supported in this layout.</div>';
}
1.27 KB in 5 ms with coderay