What did you try so far? Think out of the box… You need to keep a counter of some sort to mark the first day of the month.
Then, where you display your one day’s data like this:
<?php echo $d; ?> | You would need to check if the
day is visible in the month or not. Then, display the $d, but, if not visible, do not display it.
One way might be to calculate the first day that is visible and then check if the day is equal to or greater than that day.
Thinking OUT of the box, you must remember that you can NOT just figure out the number of days in the month and then
start displaying them before or after Monday or Sunday. (Sunday starts off the week, normally) So, either you loop thru the
month and calculate the day of the month that the first day is. Since the first day of the current money can start anywhere
inside of the current week, you can not simply loop thru all the days in the week and know what month that day is in. Let’s
say the month starts on Wednesday, but you started displaying the week on Monday? How do you know it is LAST month
for those two days? You could calculate the day of that week that the month starts in and then not display it if before that
date.
You must rethink how you are looping thru the days. Does that make sense? So if you are displaying the first week of
the month and first day of the month is the 6th day of the first week on a Saturday, you need to also know what day the first
Monday is from the last month so you can skip that many days. (So that Friday ends up being the 31st or 30th from
the month before…) Tricky, but, you can figure it out. Good luck…