I know you can set every nth row or cell of a table to have certain attributes in a for Loop
if($ib % 7){
echo '<td>'.$ib.'</td>';
}
else{
echo '<td bgcolor="005082"></td>';
}
But can you do the same for the next row aswell. In other words can I set every 7th and 8th table cell next to each other to have the same colour? I'm building a calendar and want to highlight the weekend.
You mean like
if($ib % 7 == 0 || $ib % 7 == 1){
echo '<td bgcolor="005082"></td>';
}
else {
echo '<td>'.$ib.'</td>';
}
In case you would achieve it using CSS nth-child
table tr td:nth-child(7n+7), table tr td:nth-child(7n+8) {
background: #005082;
}
I selected 6th & 7th elements as a week lasts 7 days...