Forum Moderators: coopster

Message Too Old, No Replies

I'm making a php calendar and I need help

i can't get the nubers for eace tables

         

MrGecko

6:53 pm on Aug 10, 2006 (gmt 0)

10+ Year Member



I'm making a php calendar and I can't get the numbers automatic in the tables.

Can any one help me?
Here's some of my code
<table width="80%" height="90%" border="2" bordercolor="#333333" cellspacing="1">
*<tr height="10">
**<td width="114.28571428571"><center>Sunday</center></td>
**<td width="114.28571428571"><center>Monday</center></td>
**<td width="114.28571428571"><center>Tuesday</center></td>
**<td width="114.28571428571"><center>Wednesday</center></td>
**<td width="114.28571428571"><center>Thursday</center></td>
**<td width="114.28571428571"><center>Friday</center></td>
**<td width="114.28571428571"><center>Saturday</center></td>
*</tr>
*<tr>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
*</tr>
*<tr>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
*</tr>
*<tr>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
*</tr>
*<tr>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
*</tr>
*<tr>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
**<td></td>
*</tr>
</table>

If you can help me that will be great

maherphil

9:16 pm on Aug 10, 2006 (gmt 0)

10+ Year Member



where is the php code?

ZenArcher

9:39 pm on Aug 10, 2006 (gmt 0)

10+ Year Member



There are several php classes that provide the basics of calendar making, date calculating and HTML interface creation. Simply Google "phpcalendar class"

MrGecko

10:03 pm on Aug 10, 2006 (gmt 0)

10+ Year Member



i'm hiding the php code that will add events to the calendar

[edited by: MrGecko at 10:03 pm (utc) on Aug. 10, 2006]

StupidScript

11:36 pm on Aug 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you won't take ZenArcher's excellent advice, what is it you are having trouble with, PHP-wise? (If you don't post some code, you won't get much help, I'm afraid.)

MrGecko

12:24 pm on Aug 17, 2006 (gmt 0)

10+ Year Member



I fix the calendar with this code
(<html>
<body>
<center>
<table width="80%" height="90%" border="2" bordercolor="#333333" cellspacing="1">
*<tr height="10">
**<td width="114.28571428571"><center>Sunday</center></td>
**<td width="114.28571428571"><center>Monday</center></td>
**<td width="114.28571428571"><center>Tuesday</center></td>
**<td width="114.28571428571"><center>Wednesday</center></td>
**<td width="114.28571428571"><center>Thursday</center></td>
**<td width="114.28571428571"><center>Friday</center></td>
**<td width="114.28571428571"><center>Saturday</center></td>
*</tr>
*<?
*
**$month = date(m,time());
**$year = date(Y,time());
**
**function genSet_Stop($month,$year) {
***if ($month == '12') {
****$month = 1;
****$year++;
***} else {
****$month++;
***}
***$stop = mktime(0,0,0,$month,0,$year);
***$stop = date(d,$stop);
***return ($stop);
**}
**
**echo "<center>\n";
**
**function genCalendar_Month($month,$year,$stop) {
***if ($month == 12) {
****$prev_month = $month - 1;
****$prev_year = $year;
****$next_month = 1;
****$next_year = $year + 1;
***} elseif ($month == 1) {
****$prev_month = 12;
****$prev_year = $year - 1;
****$next_month = $month + 1;
****$next_year = $year;
***} else {
****$prev_month = $month - 1;
****$prev_year = $year;
****$next_month = $month + 1;
****$next_year = $year;
***}
***$start = mktime(0,0,0,$month,1,$year);
***$start = date(w,$start);
***$date_string = $month_text . " - " . $year;
***
***$string .= "<tr>";
***for ($i = 0; $i < $start; $i++) {
****$string .= "<td bgcolor=\"#CCCCCC\">&nbsp;</td>\n";
***}
***
***for ($i = 1; $i <= $stop; $i++) {
****$day = mktime(0,0,0,$month,$i,$year);
****$frame = date(w,$day);
****if ($frame == 6) {
*****$string .= "<td>$i</td></tr><tr>\r";
****} else {
*****$string .= "<td>$i</td>\r";
****}
***}
***for ($i = 1; $frame < 6; $frame++) {
****$string .= "<td bgcolor=\"#CCCCCC\">&nbsp;</td>\n";
***}
***if ($frame < 6) { $string .= "</tr>\n"; }
***
***return ($string);
**}
**$day_number = genSet_Stop($month,$year);
*print $mid_html = genCalendar_Month($month,$year,$day_number);
*echo "</center>\r</body>\r</html>";
}?>)
Thanks ZenArcher for helping me.

[edited by: MrGecko at 12:28 pm (utc) on Aug. 17, 2006]