/* Grab the month and year */
if ($month == "" || $year == "")
{
$this_month = date("n");
$month_name = date("F");
$this_year = date("Y");
}
else
{
$this_month = date("n", mktime(0, 0, 0, $month, 1, $year));
$month_name = date("F", mktime(0, 0, 0, $month, 1, $year));
$this_year = date("Y", mktime(0, 0, 0, $month, 1, $year));
}
/* This is for the navigation */
$last_month = $this_month - 1;
$next_month = $this_month + 1;
/* Same with all this stuff */
if ($last_month == 12)
$last_year = $this_year - 1;
else
$last_year = $this_year;
/* DITTO!!! */
if ($next_month == 1)
$next_year = $this_year + 1;
else
$next_year = $this_year;
/* Display the calendar header */
echo " $month_name, $this_year © Oldgas.com. 57 Roadmaster at the pumps, US Hwy 321 in South Carolina by TG
\n"
. " \n"
. "\n"
. "Sun | \n"
. "Mon | \n"
. "Tue | \n"
. "Wed | \n"
. "Thu | \n"
. "Fri | \n"
. "Sat | \n"
. "
\n";
/* Grab the first day of the month, and total days */
$first_day = date("w", mktime(0, 0, 0, $this_month, 1, $this_year));
$total_days = date("t", mktime(0, 0, 0, $this_month, 1, $this_year));
/* Start on the day of the first week */
$week_num = 1;
$day_num = 1;
/* While the day of the week isn't '7' */
while ($week_num <= 6)
{
echo "\n";
/* Loop through the week days */
for ( $i = 0; $i <= 6; $i++ )
{
/* If it's the first week then... */
if ($week_num == 1)
{
/* If it's not the first day yet, then use a space */
if ($i < $first_day)
$the_day = " ";
/* If it is the first day, then start with a '1' */
else if ($i == $first_day)
{
$the_day = 1;
}
}
else
{
/* If we're past the total days, then use spaces */
if ($the_day > $total_days)
$the_day = " ";
}
/* Display the day (or space) */
echo "$the_day | \n";
/* Incrememnt the day of the month */
if ($the_day != " ")
$the_day++;
}
echo "
\n";
/* Increment the week number */
$week_num++;
}
/* Finish off with closing out our tags */
echo "
\n"
. "
\n"
. " \n"
. "Click here to Change to Next Month >> | Print Calendar | View Events Listings | Calendar Archive | Visit Oldgas.com\n"
. " \n";
?>
Join us at Oldgas.com - Shop Talk Petro Collectible Discussion Forum, Classified
Ads, Petro Web Directory, Collectors Roster