Hi Daniweb,
I'm trying to create a basic, grid-based (table-layout) calendar using PHP. I'm in the planning stages currently, but need some help coming up with an effective way to display empty boxes (for instance, November starts on Monday, so the left-most box (Sunday) needs to be empty. December starts Wednesday, so Sunday-Monday-Tuesday need to have empty, unmarked boxes (maybe black backgrounds?).
So, here's my current planning info.
What I need to Know
Current date (month + year)
First day value (0-6) [found with date("w", mktime(0,0,0,month,day,year))...]
Total days in month
Number of weeks in a month (can be 4-6)
Counter to loop through each day
---
I have a basic idea of how to create a proper for loop of a for loop, but I can't seem to make the "blanks" appear correctly.
for($rows = 0; $rows < $weeksInMonth; $rows++)
{
for($daysInWeek = 0; $daysInWeek < 7; $daysInWeek++)
{
LOOP THROUGH DAYS, BUT WHAT'S THE LOGIC FOR BLANK BOXES?
}
}
If anyone could help me out, I'd appreciate it. I don't need a full, detailed answer per se, but a shove the right way would help. :D
Thanks a lot! It's 12:20A.M. and I'll be up all night so I'll check in frequently.