hi ,
here is file calendar.php and it displayes calendar and also by you can
diaplay content by selecting from database and displaying in the right month
I hope this helps and if there is any thing else do get back to me.
Vinod
======================
<?
//----------------- This function is to do the HTML header
chore---------------------
function print_HTML_header()
{
echo "<HTML>\n<HEAD>\n<STYLE>\n".
"<!--\nTD{ FONT-FAMILY:verdana,arial; FONT-SIZE:11; }\n-->\n</STYLE>".
"<TITLE>Calendar\n</TITLE>\n</HEAD>\n<BODY >\n\n";
}
//----------------- This function is to do the HTML footer
chore---------------------
function print_HTML_footer()
{
echo "</BODY></HTML>";
}
?>
<SCRIPT LANGUAGE="JavaScript">
<!--
function submit_close(month,day,year)
{
<?if ($date_format == "mm-dd-yyyy")
{?>
newdate = month + "-" + day + "-" + year;
<?}else{?>
newdate = day + "-" + month + "-" + year;
<?}?>
window.opener.<?print trim($form_name);?>.<?print
trim($return_to);?>.value=newdate;
window.close()
}
//-->
</SCRIPT>
<?
//----------------- This function prints calendar---------------------
function print_calendar($mon,$year)
{
global $dates, $first_day, $start_day,$return_to,$form_name,$date_format;
$first_day = mktime(0,0,0,$mon,1,$year);
$start_day = date("w",$first_day);
$res = getdate($first_day);
$month_name = $res["month"];
$no_days_in_month = date("t",$first_day);
//If month's first day does not start with first Sunday, fill table cell
with a space
for ($i = 1; $i <= $start_day;$i++)
$dates[1][$i] = " ";
$row = 1;
$col = $start_day+1;
$num = 1;
while($num<=31)
{
if ($num > $no_days_in_month)
break;
else
{
$dates[$row][$col] = $num;
if (($col + 1) > 7)
{
$row++;
$col = 1;
}
else
$col++;
$num++;
}//if-else
}//while
$mon_num = date("n",$first_day);
$temp_yr = $next_yr = $prev_yr = $year;
$prev = $mon_num - 1;
$next = $mon_num + 1;
//If January is currently displayed, month previous is December of
previous year
if ($mon_num == 1)
{
$prev_yr = $year - 1;
$prev = 12;
}
//If December is currently displayed, month next is January of next year
if ($mon_num == 12)
{
$next_yr = $year + 1;
$next = 1;
}
?>
<?
echo "<DIV ALIGN='center'><TABLE BORDER=1 WIDTH=40% CELLSPACING=0
BORDERCOLOR='silver'>";
echo "\n<TR ALIGN='center'><TD BGCOLOR='white'> ".
"<A
HREF=\"calendar.php?date_format=".$date_format."&month=$prev&year=$prev_yr&r
eturn_to=$return_to&form_name=$form_name\" STYLE=\"text-decoration:
none\"><B><<</B></A> </TD>".
"<TD COLSPAN=5 BGCOLOR='#3366FF'><font
color=white><B>".date("F",$first_day)." ".$temp_yr."</B></font></TD>".
"<TD BGCOLOR='white'> ".
"<A
HREF=\"calendar.php?date_format=".$date_format."&month=$next&year=$next_yr&r
eturn_to=$return_to&form_name=$form_name\" STYLE=\"text-decoration:
none\"><B>>></B></A> </TD></TR>";
echo "\n<TR
ALIGN='center'><TD><B>Sun</B></TD><TD><B>Mon</B></TD><TD><B>Tue</B></TD>";
echo
"<TD><B>Wed</B></TD><TD><B>Thu</B></TD><TD><B>Fri</B></TD><TD><B>Sat</B></TD
></TR>";
echo "<TR><TD COLSPAN=7> </TR><TR ALIGN='center'>";
$end = ($start_day > 4)? 6:5;
for ($row=1;$row<=$end;$row++)
{
for ($col=1;$col<=7;$col++)
{
if ($dates[$row][$col] == "")
$dates[$row][$col] = " ";
if (!strcmp($dates[$row][$col]," "))
$count++;
$t = $dates[$row][$col];
//If date is today, highlight it
if (($t == date("j")) && ($mon == date("n")) && ($year == date("Y")))
echo "\n<TD BGCOLOR='aqua'><a
href=\"javascript:submit_close('$mon','$t','$year')\">".$t."</a></TD>";
else
//If the date is absent ie after 31, print space
echo "\n<TD>".(($t == " " )? " " :"<a
href=\"javascript:submit_close('$mon','$t','$year')\">".$t."")."</TD>";
}// for -col
if (($row + 1) != ($end+1))
echo "</TR>\n<TR ALIGN='center'>";
else
echo "</TR>";
}// for - row
echo "\n</TABLE>";
}
//----------Main Loop-----------
print_HTML_header();
//If $month is not present, set it to current month.
$month = (empty($month)) ? date("n") : $month;
//If $year is not present, set it to current year.
$year = (empty($year)) ? date("Y") : $year;
print_calendar($month,$year);
print_HTML_footer();
?>
======================
--
Vinod Palan A
Calypso Technology, Inc.
[EMAIL PROTECTED]
(415) 817-2463 Phone
"Kevin P" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi
> I am trying to feature a calendar on a web site. I would like it to
display
> on a page and be able to change to another month when this is requested
and
> display items for the general public. I want the client to be able to go
> into the database and update the items and those items to appear on the
> site. Is there something outthere already packaged like this?
>
> Kevin P
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php