Gå til innhold

Kalender - Sette startdag


Anbefalte innlegg

Hei!

 

Har funnet med en fancy kalender jeg vil bruke, men den har søndag som "startdag".

Kan noen se på scriptet å se om de finner ut hvordan jeg setter mandag til første dag? :)

 


<?php



echo "<center>";



$current_month=1;

$current_year = 2004;



while ($current_month!=13) {



 //************************************************************

 //  Script:           DF Calendar

 //  Programmer:       Chris Jackson

 //  Date:             7/2/03

 //  Version:          0.2.57

 //************************************************************

 

 //************************************************************

 //Versions:

 //************************************************************

 // 0.1.13 - Initial Release.

 //

 // 0.2.57 - Added the ability to custom configure the calendar

 //to any month, day or year along with cosmetic variables

 //allowing you to be able to totally customize the 

 //calendar.

 

 //************************************************************

 //External variables:  (ex. calendar.php?mn=12&dy=3&yr=2003)

 //************************************************************

 // tcs = Set Table Cell Spacing

 // tcp = Set Table Cell Padding

 // tbd = Set Table Border

 // mn = Set month (1-12)

 // dy = Set day (1-31)

 // yr = Set year (4 digit year)

 // nm = Set to Next Month (equal to 1)

 // lm = Set to Last Month (equal to 1)

 // mt = Set Calendar to NOT Mark Today (equal to 1)

 // dbh = Set Day Box Height (pixel height of day boxes)

 // dbw = Set Day Box Width (pixel width of day boxes)

 // wbh = Set Weekday Box Height (pixel height of weekday boxes)

 // ctfs = Set Calendar Title Font Size (ex. 10, 12, 14)

 // ctfw = Set Calendar Title Font Weight (ex. bold)

 // ctfc = Set Calendar Title Font Color (ex. 000000)

 // ctbc = Set Calendar Title Background Color (ex. 000000)

 // ctal = Set Calendar Title Alignment (ex. left, right, center)

 // ndfs = Set Normal Day Font Size (ex. 10, 12, 14)

 // ndfc = Set Normal Day Font Color (ex. 000000)

 // ndbc = Set Normal Day Background Color (ex. 000000)

 // ndal = Set Normal Day Alignment (ex. left, right, center)

 // ndva = Set Normal Day Vertical Alignment (ex. top, middle, bottom)

 // mdfc = Set Mark Day Font Color (ex. FF0000)

 // mdbc = Set Mark Day Background Color (ex. 000000)

 // bdbc = Set Blank Day Background Color (ex. 000000)

 // wtfs = Set Weekday Title Font Size (ex. 10, 12, 14)

 // wtfc = Set Weekday Title Font Color (ex. 000000)

 // wtbc = Set Weekday Title Background Color (ex. 000000)

 // wtal = Set Weekday Title Alignment (ex. left, right, center)

 // wtva = Set Weekday Title Vertical Alignment (ex. top, middle, bottom)

 // wk = Set weekday titles to Full names (equal to 1)  



 // *******************************

 // ctfn = Calendar Title Font Name

 // ndfn = Normal Day Font Name

 // mdfn = Mark Day Font Name

 // wtfn = Weekday Title Font Name

 // *******************************

 // Set the above variables to one of the following:

 // 1 = Verdana, Arial, Helvetica, sans-serif

 // 2 = Arial, Helvetica, sans-serif

 // 3 = Times New Roman, Times, serif

 // 4 = Courier New, Courier, mono

 // 5 = Georgia, Times New Roman, Times, serif

 // 6 = Geneva, Arial, Helvetica, sans-serif



 //Set the months of the year into an array.

 $month[1] = "Januar";

 $month[2] = "Februar";

 $month[3] = "Mars";

 $month[4] = "April";

 $month[5] = "Mai";

 $month[6] = "Juni";

 $month[7] = "Juli";

 $month[8] = "August";

 $month[9] = "September";

 $month[10] = "Oktober";

 $month[11] = "November";

 $month[12] = "Desember";



 //Set week title names for the days of the week.

 if ($wk) { 

   //Use full names for week days

   $week[0] = "Søndag";  // Sunday

   $week[1] = "Mandag";  // Monday

   $week[2] = "Tirsdag";  // Tuesday

   $week[3] = "Onsdag";  // Wednesday

   $week[4] = "Torsdag";  // Thursday

   $week[5] = "Fredag";  // Friday

   $week[6] = "Lørdag";  // Saturday

 }

 else {

   //Use short names for week days

   $week[0] = "S";  // Sunday

   $week[1] = "M";  // Monday

   $week[2] = "T";  // Tuesday

   $week[3] = "O";  // Wednesday

   $week[4] = "T";  // Thursday

   $week[5] = "F";  // Friday

   $week[6] = "L";  // Saturday

 }



 /*

 //Get current month, returned in numeric format 1-12

 if (!$mn) { $current_month = date("n"); } else { $current_month = $mn; }



 //Set Calendar to Next Month

 if ($nm) {

   if ($current_month == 12) { $current_month=1; } else { $current_month++; }

$mt=1;	//Turn off the today mark

 }

 

 //Set Calendar to Last Month

 if ($lm) {

   if ($current_month == 1) { $current_month=12; } else { $current_month--; }

$mt=1;  //Turn off the today mark

 }

 */



 //Get current day, returned in numeric format 1-31

 if (!$dy) { $current_day = date("j"); } else { $current_day = $dy; }



 /*

 //Get current year, returned in four digit numeric format

 if (!$yr) { $current_year = date("Y"); } else { $current_year = $yr; }

 */



 //Get Days in this month, returned in numeric format 28-31

 $days_in_month = date("t", mktime(0,0,0, $current_month, $current_day, $current_year));



 //Get the day of the week that the first day of the month falls on, returned numeric format 0-6

 // (same numbering for days of week as the $week array above)

 $first_day = date("w", mktime(0,0,0,$current_month,1,$current_year));



 //Table Properties

 if (!$tcs) { $tcs = 1; }  	//Cell Spacing

 if (!$tcp) { $tcp = 0; }  //Cell Padding

 if (!$tbd) { $tbd = 0; }  //Border 

 

 //Set Day Box Height

 //If no value is passed, then default to mini calendar settings.

 if (!$dbh) { $dbh = "70"; }

 

 //Set Day Box Width

 //If no value is passed, then default to mini calendar settings.

 if (!$dbw) { $dbw = "75"; }

 

 //Set Weekday Box Height

 //If no value is passed, then default to mini calendar settings.

 if (!$wbh) { $wbh = "0"; }

 

 //Set to NOT mark Today

 if (!$mt) { $mt = 1; }



 //Calendar Title Options

 //********************

 if (!$ctfs) { $ctfs = 40; }  	//Set Font Size

 if (!$ctfw) { $ctfw = "bold"; }  //Set Font Weight

 if (!$ctfc) { $ctfc = "#000000"; }	//Set Font Color

 if (!$ctbc) { $ctbc = ""; }  	//Set Cell Background Color

 if (!$ctal) { $ctal = "center"; }  //Set Alignment

 if ((!$ctfn) || ($ctfn==1)) { $ctfn = "Verdana, Arial, Helvetica, sans-serif"; }  //Font Name

 if ($ctfn==2) { $ctfn = "Arial, Helvetica, sans-serif"; }  

 if ($ctfn==3) { $ctfn = "Times New Roman, Times, serif"; }

 if ($ctfn==4) { $ctfn = "Courier New, Courier, mono"; }

 if ($ctfn==5) { $ctfn = "Georgia, Times New Roman, Times, serif"; }

 if ($ctfn==6) { $ctfn = "Geneva, Arial, Helvetica, sans-serif"; }

 

 //Normal Day Options

 //********************

 if (!$ndfs) { $ndfs = 30; }  	//Font Size

 if (!$ndfc) { $ndfc = "#000000"; }	//Font Color

 if (!$ntfw) { $ntfw = "bold"; }  //Set Font Weight

 if (!$ndbc) { $ndbc = "#F7F7F7"; }	//Background Color ecf8ff

 if (!$ndal) { $ndal = "center"; }  //Text Alignment

 if (!$ndva) { $ndva = "middle"; }  //Vertical Alignment

 if ((!$ndfn) || ($ndfn==1)) { $ndfn = "Verdana, Arial, Helvetica, sans-serif"; }  //Font Name

 if ($ndfn==2) { $ndfn = "Arial, Helvetica, sans-serif"; }  

 if ($ndfn==3) { $ndfn = "Times New Roman, Times, serif"; }

 if ($ndfn==4) { $ndfn = "Courier New, Courier, mono"; }

 if ($ndfn==5) { $ndfn = "Georgia, Times New Roman, Times, serif"; }

 if ($ndfn==6) { $ndfn = "Geneva, Arial, Helvetica, sans-serif"; }



 //Mark Day Options

 //********************

 if (!$mdfc) { $mdfc = "#FF0000"; }	//Font Color

 if (!$mdbc) { $mdbc = "#EAF5FF"; }	//Background Color ecf8ff

 if ((!$mdfn) || ($mdfn==1)) { $mdfn = "Verdana, Arial, Helvetica, sans-serif"; }  //Font Name

 if ($mdfn==2) { $mdfn = "Arial, Helvetica, sans-serif"; }  

 if ($mdfn==3) { $mdfn = "Times New Roman, Times, serif"; }

 if ($mdfn==4) { $mdfn = "Courier New, Courier, mono"; }

 if ($mdfn==5) { $mdfn = "Georgia, Times New Roman, Times, serif"; }

 if ($mdfn==6) { $mdfn = "Geneva, Arial, Helvetica, sans-serif"; }

 

 //Blank Day Options

 //********************

 if (!$bdbc) { $bdbc = "#EEEEEE"; }	//Background Color eaf5ff

 

 //Weekday Title Options

 //********************

 if (!$wtfs) { $wtfs = 30; }  	//Font Size

 if (!$wtfc) { $wtfc = "#000000"; }	//Font Color

 if (!$wtfw) { $wtfw = "bold"; }  //Set Font Weight

 if (!$wtbc) { $wtbc = "#C9C9C9"; }	//Background Color ffffe8

 if (!$wtal) { $wtal = "center"; }  //Text Alignment

 if (!$wtva) { $wtva = "middle"; }  //Vertical Alignment

 if ((!$wtfn) || ($wtfn==1)) { $wtfn = "Verdana, Arial, Helvetica, sans-serif"; }  //Font Name

 if ($wtfn==2) { $wtfn = "Arial, Helvetica, sans-serif"; }  

 if ($wtfn==3) { $wtfn = "Times New Roman, Times, serif"; }

 if ($wtfn==4) { $wtfn = "Courier New, Courier, mono"; }

 if ($wtfn==5) { $wtfn = "Georgia, Times New Roman, Times, serif"; }

 if ($wtfn==6) { $wtfn = "Geneva, Arial, Helvetica, sans-serif"; }

 

?>



<style type="text/css">

<!--

.CalendarTitle {

font-family: <?php print $ctfn; ?>;

font-size: <?php print $ctfs; ?>px;

font-weight: <?php print $ctfw; ?>;

color: <?php print $ctfc; ?>;

background-color: <?php print $ctbc; ?>;

text-align: <?php print $ctal; ?>;

}

.NormalDay {

font-family: <?php print $ndfn; ?>;

font-size: <?php print $ndfs; ?>px;

font-weight: <?php print $ntfw; ?>;

color: <?php print $ndfc; ?>;

background-color: <?php print $ndbc; ?>;

text-align: <?php print $ndal; ?>;

vertical-align: <?php print $ndva; ?>;

}

.MarkDay {

font-family: <?php print $mdfn; ?>;

font-size: <?php print $ndfs; ?>px;

color: <?php print $mdfc; ?>;

background-color: <?php print $mdbc; ?>;

text-align: <?php print $ndal; ?>;

vertical-align: <?php print $ndva; ?>;

}

.BlankDay {

background-color: <?php print $bdbc; ?>;

}

.WeekdayTitle {

font-family: <?php print $wtfn; ?>;

font-size: <?php print $wtfs; ?>px;

font-weight: <?php print $wtfw; ?>;

color: <?php print $wtfc; ?>;

background-color: <?php print $wtbc; ?>;

text-align: <?php print $wtal; ?>;

vertical-align: <?php print $wtva; ?>;

}

-->

</style>

<table border="<?php print $tbd; ?>" cellpadding="<?php print $tcp; ?>" cellspacing="<?php print $tcs; ?>" width="<?php print $dbw * 7; ?>">

   <tr>

     <td class="CalendarTitle">

<?php



print "$month[$current_month] $current_year";



?>

     </td>

   </tr>

 </table>

 <table border="<?php print $tbd; ?>" cellpadding="<?php print $tcp; ?>" cellspacing="<?php print $tcs; ?>" width="<?php print $dbw * 7; ?>">

   

 <tr> 

   <?php



 //Loop through days of the week and display the short names above the columns in the calendar

 for ($i=0;$i<7;$i++) {

   print "      <td width="$dbw" height="$wbh" class="WeekdayTitle">$week[$i]</td>n";

 }



?>

 </tr>

 <?php



 //Set the day counter to the first day, 1.

 $day_counter = 1;



 //This line continues running the loop until all the days of the month have been displayed.

 while($day_counter <= $days_in_month) {

   print "  <tr>n";



   //Loop through the days of the week to display each day number.

   for($i = 0; $i < 7; $i++) {

     //This line makes sure that a day should be drawn on this particular calendar spot.

  //To draw a day for this spot, there must be one of two cases true:

  // 1 - The day counter is still within the amount of days for this month and the first

  //day is not set to 0 and the first day is set to this spot.

  // 2 - The day counter is still within the amount of days for this month and the first

  //day is equal to 0.

  if ((($day_counter <= $days_in_month) && ($first_day != 0) && ($first_day == $i)) || (($day_counter <= $days_in_month) && ($first_day == 0))) {

       //check to see if the current day counter is today's day

 if (($day_counter == $current_day) && (!$mt)) {

        print "      <td width="$dbw" height="$dbh" class="MarkDay">$day_counter</td>n";

 }

 else {

        print "      <td width="$dbw" height="$dbh" class="NormalDay">$day_counter</td>n";

 }

       //Resetting first_day tells us that the first day of the month has already been drawn.

       $first_day = 0;

       $day_counter++;

     }

     else {

    //No day number should be drawn on this calendar spot, therefore draw a blank spot.

       print "      <td width="$dbw" height="$dbh" class="BlankDay"> </td>n";

     }

   }



   print "  </tr>n";

 }



echo "</table>";

echo "<br><br><br><br><br><br>";



$current_month++;

}

?>

Lenke til kommentar
Videoannonse
Annonse
Gjest Slettet-rXRozPkg

Bytt fra:


if ($wk) { 

   //Use full names for week days 

   $week[0] = "Søndag";  // Sunday 

   $week[1] = "Mandag";  // Monday 

   $week[2] = "Tirsdag";  // Tuesday 

   $week[3] = "Onsdag";  // Wednesday 

   $week[4] = "Torsdag";  // Thursday 

   $week[5] = "Fredag";  // Friday 

   $week[6] = "Lørdag";  // Saturday 

 } 

 else { 

   //Use short names for week days 

   $week[0] = "S";  // Sunday 

   $week[1] = "M";  // Monday 

   $week[2] = "T";  // Tuesday 

   $week[3] = "O";  // Wednesday 

   $week[4] = "T";  // Thursday 

   $week[5] = "F";  // Friday 

   $week[6] = "L";  // Saturday 

 } 



Til:




if ($wk) { 

   //Use full names for week days 

   $week[0] = "Mandag";  // Monday 

   $week[1] = "Tirsdag";  // Tuesday 

   $week[2] = "Onsdag";  // Wednesday 

   $week[3] = "Torsdag";  // Thursday 

   $week[4] = "Fredag";  // Friday 

   $week[5] = "Lørdag";  // Saturday 

   $week[6] = "Søndag";  // Sunday 



 } 

 else { 

   //Use short names for week days 

   $week[0] = "M";  // Monday 

   $week[1] = "T";  // Tuesday 

   $week[2] = "O";  // Wednesday 

   $week[3] = "T";  // Thursday 

   $week[4] = "F";  // Friday 

   $week[5] = "L";  // Saturday 

   $week[6] = "S";  // Sunday 



 } 

 

Tror ikke det skal være noe mer enn det....

Lenke til kommentar
Gjest Slettet-rXRozPkg

Det var ikke så lett nei :lol:

Men dette skal fungere:

(Jeg har tatt bort en del kommentarer fra den orginale koden, siden de ikke trengs)


<?php 



echo "<center>"; 



$current_month=1; 

$current_year = 2004; 



while ($current_month!=13) { 



 //Set the months of the year into an array. 

 $month[1] = "Januar"; 

 $month[2] = "Februar"; 

 $month[3] = "Mars"; 

 $month[4] = "April"; 

 $month[5] = "Mai"; 

 $month[6] = "Juni"; 

 $month[7] = "Juli"; 

 $month[8] = "August"; 

 $month[9] = "September"; 

 $month[10] = "Oktober"; 

 $month[11] = "November"; 

 $month[12] = "Desember"; 



 //Set week title names for the days of the week. 

 if ($wk) { 

   //Use full names for week days 

   

   $week[0] = "Mandag";  // Monday 

   $week[1] = "Tirsdag";  // Tuesday 

   $week[2] = "Onsdag";  // Wednesday 

   $week[3] = "Torsdag";  // Thursday 

   $week[4] = "Fredag";  // Friday 

   $week[5] = "Lørdag";  // Saturday 

   $week[6] = "Søndag";  // Sunday 

 } 

 else { 

   //Use short names for week days 

   

   $week[0] = "M";  // Monday 

   $week[1] = "T";  // Tuesday 

   $week[2] = "O";  // Wednesday 

   $week[3] = "T";  // Thursday 

   $week[4] = "F";  // Friday 

   $week[5] = "L";  // Saturday 

   $week[6] = "S";  // Sunday 

 } 



 //Get current day, returned in numeric format 1-31 

 if (!$dy) { $current_day = date("j"); } else { $current_day = $dy; } 



 //Get Days in this month, returned in numeric format 28-31 

 $days_in_month = date("t", mktime(0,0,0, $current_month, $current_day, $current_year)); 



 //Get the day of the week that the first day of the month falls on, returned numeric format 0-6 

 // (same numbering for days of week as the $week array above) 

 $first_day = date("w", mktime(0,0,0,$current_month,1,$current_year)); 



 //Table Properties 

 if (!$tcs) { $tcs = 1; }       //Cell Spacing 

 if (!$tcp) { $tcp = 0; }      //Cell Padding 

 if (!$tbd) { $tbd = 0; }      //Border 

 

 //Set Day Box Height 

 //If no value is passed, then default to mini calendar settings. 

 if (!$dbh) { $dbh = "70"; } 

 

 //Set Day Box Width 

 //If no value is passed, then default to mini calendar settings. 

 if (!$dbw) { $dbw = "75"; } 

 

 //Set Weekday Box Height 

 //If no value is passed, then default to mini calendar settings. 

 if (!$wbh) { $wbh = "0"; } 

 

 //Set to NOT mark Today 

 if (!$mt) { $mt = 1; } 



 //Calendar Title Options 

 //******************** 

 if (!$ctfs) { $ctfs = 40; }         //Set Font Size 

 if (!$ctfw) { $ctfw = "bold"; }      //Set Font Weight 

 if (!$ctfc) { $ctfc = "#000000"; }   //Set Font Color 

 if (!$ctbc) { $ctbc = ""; }         //Set Cell Background Color 

 if (!$ctal) { $ctal = "center"; }      //Set Alignment 

 if ((!$ctfn) || ($ctfn==1)) { $ctfn = "Verdana, Arial, Helvetica, sans-serif"; }      //Font Name 

 if ($ctfn==2) { $ctfn = "Arial, Helvetica, sans-serif"; }       

 if ($ctfn==3) { $ctfn = "Times New Roman, Times, serif"; } 

 if ($ctfn==4) { $ctfn = "Courier New, Courier, mono"; } 

 if ($ctfn==5) { $ctfn = "Georgia, Times New Roman, Times, serif"; } 

 if ($ctfn==6) { $ctfn = "Geneva, Arial, Helvetica, sans-serif"; } 

 

 //Normal Day Options 

 //******************** 

 if (!$ndfs) { $ndfs = 30; }         //Font Size 

 if (!$ndfc) { $ndfc = "#000000"; }   //Font Color 

 if (!$ntfw) { $ntfw = "bold"; }      //Set Font Weight 

 if (!$ndbc) { $ndbc = "#F7F7F7"; }   //Background Color ecf8ff 

 if (!$ndal) { $ndal = "center"; }      //Text Alignment 

 if (!$ndva) { $ndva = "middle"; }      //Vertical Alignment 

 if ((!$ndfn) || ($ndfn==1)) { $ndfn = "Verdana, Arial, Helvetica, sans-serif"; }      //Font Name 

 if ($ndfn==2) { $ndfn = "Arial, Helvetica, sans-serif"; }       

 if ($ndfn==3) { $ndfn = "Times New Roman, Times, serif"; } 

 if ($ndfn==4) { $ndfn = "Courier New, Courier, mono"; } 

 if ($ndfn==5) { $ndfn = "Georgia, Times New Roman, Times, serif"; } 

 if ($ndfn==6) { $ndfn = "Geneva, Arial, Helvetica, sans-serif"; } 



 //Mark Day Options 

 //******************** 

 if (!$mdfc) { $mdfc = "#FF0000"; }   //Font Color 

 if (!$mdbc) { $mdbc = "#EAF5FF"; }   //Background Color ecf8ff 

 if ((!$mdfn) || ($mdfn==1)) { $mdfn = "Verdana, Arial, Helvetica, sans-serif"; }      //Font Name 

 if ($mdfn==2) { $mdfn = "Arial, Helvetica, sans-serif"; }       

 if ($mdfn==3) { $mdfn = "Times New Roman, Times, serif"; } 

 if ($mdfn==4) { $mdfn = "Courier New, Courier, mono"; } 

 if ($mdfn==5) { $mdfn = "Georgia, Times New Roman, Times, serif"; } 

 if ($mdfn==6) { $mdfn = "Geneva, Arial, Helvetica, sans-serif"; } 

 

 //Blank Day Options 

 //******************** 

 if (!$bdbc) { $bdbc = "#EEEEEE"; }   //Background Color eaf5ff 

 

 //Weekday Title Options 

 //******************** 

 if (!$wtfs) { $wtfs = 30; }         //Font Size 

 if (!$wtfc) { $wtfc = "#000000"; }   //Font Color 

 if (!$wtfw) { $wtfw = "bold"; }      //Set Font Weight 

 if (!$wtbc) { $wtbc = "#C9C9C9"; }   //Background Color ffffe8 

 if (!$wtal) { $wtal = "center"; }    //Text Alignment 

 if (!$wtva) { $wtva = "middle"; }      //Vertical Alignment 

 if ((!$wtfn) || ($wtfn==1)) { $wtfn = "Verdana, Arial, Helvetica, sans-serif"; }      //Font Name 

 if ($wtfn==2) { $wtfn = "Arial, Helvetica, sans-serif"; }       

 if ($wtfn==3) { $wtfn = "Times New Roman, Times, serif"; } 

 if ($wtfn==4) { $wtfn = "Courier New, Courier, mono"; } 

 if ($wtfn==5) { $wtfn = "Georgia, Times New Roman, Times, serif"; } 

 if ($wtfn==6) { $wtfn = "Geneva, Arial, Helvetica, sans-serif"; } 

 

?> 



<style type="text/css"> 

<!-- 

.CalendarTitle { 

  font-family: <?php print $ctfn; ?>; 

  font-size: <?php print $ctfs; ?>px; 

  font-weight: <?php print $ctfw; ?>; 

  color: <?php print $ctfc; ?>; 

  background-color: <?php print $ctbc; ?>; 

  text-align: <?php print $ctal; ?>; 

} 

.NormalDay { 

  font-family: <?php print $ndfn; ?>; 

  font-size: <?php print $ndfs; ?>px; 

  font-weight: <?php print $ntfw; ?>; 

  color: <?php print $ndfc; ?>; 

  background-color: <?php print $ndbc; ?>; 

  text-align: <?php print $ndal; ?>; 

  vertical-align: <?php print $ndva; ?>; 

} 

.MarkDay { 

  font-family: <?php print $mdfn; ?>; 

  font-size: <?php print $ndfs; ?>px; 

  color: <?php print $mdfc; ?>; 

  background-color: <?php print $mdbc; ?>; 

  text-align: <?php print $ndal; ?>; 

  vertical-align: <?php print $ndva; ?>; 

} 

.BlankDay { 

  background-color: <?php print $bdbc; ?>; 

} 

.WeekdayTitle { 

  font-family: <?php print $wtfn; ?>; 

  font-size: <?php print $wtfs; ?>px; 

  font-weight: <?php print $wtfw; ?>; 

  color: <?php print $wtfc; ?>; 

  background-color: <?php print $wtbc; ?>; 

  text-align: <?php print $wtal; ?>; 

  vertical-align: <?php print $wtva; ?>; 

} 

--> 

</style> 

<table border="<?php print $tbd; ?>" cellpadding="<?php print $tcp; ?>" cellspacing="<?php print $tcs; ?>" width="<?php print $dbw * 7; ?>"> 

   <tr> 

     <td class="CalendarTitle"> 

<?php 



print "$month[$current_month] $current_year"; 



?> 

     </td> 

   </tr> 

 </table> 

 <table border="<?php print $tbd; ?>" cellpadding="<?php print $tcp; ?>" cellspacing="<?php print $tcs; ?>" width="<?php print $dbw * 7; ?>"> 

   

 <tr> 

   <?php 



 //Loop through days of the week and display the short names above the columns in the calendar 

 for ($i=0;$i<7;$i++) { 

   print "   <td width="$dbw" height="$wbh" class="WeekdayTitle">$week[$i]</td>n"; 

 } 



?> 

 </tr> 

 <?php 



 //Set the day counter to the first day, 1. 

 $day_counter = 1; 



 //This line continues running the loop until all the days of the month have been displayed. 

 while($day_counter <= $days_in_month) { 

   print "  <tr>n"; 



   //Loop through the days of the week to display each day number. 

   for($i = 0; $i < 7; $i++) { 

     if ((($day_counter <= $days_in_month) && ($first_day != 0) && ($first_day == $i+1)) || (($day_counter <= $days_in_month) && ($first_day == 0))) { 

     	

     	//check to see if the current day counter is today's day 

       if (($day_counter == $current_day) && (!$mt)) { 

            print "      <td width="$dbw" height="$dbh" class="MarkDay">$day_counter</td>n"; 

       } else { 

            print "      <td width="$dbw" height="$dbh" class="NormalDay">$day_counter</td>n"; 

       } 

     	

      //Resetting first_day tells us that the first day of the month has already been drawn. 

       $first_day = 0; 

       $day_counter++;

     

     } else { 

      //No day number should be drawn on this calendar spot, therefore draw a blank spot. 

       print "      <td width="$dbw" height="$dbh" class="BlankDay"> </td>n"; 

     } 

   } 



   print "  </tr>n"; 

 } 



echo "</table>"; 

echo "<br><br><br><br><br><br>"; 



$current_month++; 

} 

?> 



Lenke til kommentar

//Set week title names for the days of the week.

 if ($wk) { 

 

Lurte på noe, jeg prøvde og teste dette.. men fikk feil.

Undefined variable : wk

Riktignok får jeg se kalender lengre nede i lista.. men slitsomt med alle de error linjene.

Jeg er ikke noe flink i PHP..

Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
×
×
  • Opprett ny...