我想将过去工作日的颜色更改为灰色 然后将颜色更改为蓝色
我的代码是:
$week .= str_repeat('<td></td>', $str);
for ( $day = 1; $day <= $day_count; $day++, $str++)
{
$date = $ym . '-' . $day;
if ($today == $date)
{
$week .= '<td class="today">' . $day;
}
else
{
$week .= '<td>'.$day;
}
$week .= '</td>';
// End of the week OR End of the month
if ($str % 7 == 6 || $day == $day_count) {
if ($day == $day_count) {
// Add empty cell
$week .= str_repeat('<td></td>', 6 - ($str % 7));
}
$weeks[] = '<tr>' . $week . '</tr>';
// Prepare for new week
$week = '';
}
}
这是我的日历
答案 0 :(得分:0)
尝试一下:
$previous_days = true;
$week .= str_repeat('<td></td>', $str);
for ( $day = 1; $day <= $day_count; $day++, $str++)
{
$date = $ym . '-' . $day;
if ($today == $date) {
$week .= '<td class="today">' . $day;
$previous_days = false;
}else if($previous_days){
$week .= '<td class="previous-day">'.$day;
}else{
$week .= '<td class="upcoming-day">'.$day;
}
$week .= '</td>';
// End of the week OR End of the month
if ($str % 7 == 6 || $day == $day_count) {
if ($day == $day_count) {
// Add empty cell
$week .= str_repeat('<td></td>', 6 - ($str % 7));
}
$weeks[] = '<tr>' . $week . '</tr>';
// Prepare for new week
$week = '';
}
}