php foreach array_values items rows as key item if key tr style backgr

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
<?php foreach(array_values($items['rows']) as $key=>$item):?>
if ($key%2==0) {
<tr style=background-color:red>
<td><center><?php print $item['about'];?></center></td>
<td><center><a href="<?php print sefRelToAbs('index.php?option='.$option.'&amp;Itemid='.$Itemid.'&amp;id=' . $item['id']);?>"><?php print $item['title'];?></a><center></td>
<td><center><?php print date('d.m.Y', strtotime($item['start']));?></center></td>
<td><center><?php print date('d.m.Y', strtotime($item['finish']));?></center></td>
<td><center><?php print $methods[$item['method']]['title'];?></center></td>
</tr>
}
if ($key%2!=0) {
<tr style=background-color:green>
<td><center><?php print $item['about'];?></center></td>
<td><center><a href="<?php print sefRelToAbs('index.php?option='.$option.'&amp;Itemid='.$Itemid.'&amp;id=' . $item['id']);?>"><?php print $item['title'];?></a><center></td>
<td><center><?php print date('d.m.Y', strtotime($item['start']));?></center></td>
<td><center><?php print date('d.m.Y', strtotime($item['finish']));?></center></td>
<td><center><?php print $methods[$item['method']]['title'];?></center></td>
</tr>
}
<?php endforeach;?>