Jump to content

Event Calendar


pbeerman

Recommended Posts

Hi All - I am using a template from Hypersilence.net (Events calendar) and am running into a problem.  The calendar is supposed to only display the event for the current day.  However, I would like it to display all events forward.  Any ideas?

 

 

 

<?PHP

$date = time();

 

$day = date("d", $date);

$month = date("m", $date);

$year = date("Y", $date);

 

// These are the events displayed underneath the calendar

// Events will be changed each day according to the list below

// If you don't want events enabled, change the following variable to false

 

$enable_events = true;

 

$event_01 = "First day of the month events go here.";

$event_02 = "Second day of the month events go here.";

$event_03 = "Third day of the month events go here.";

$event_04 = "Fourth day of the month events go here.";

$event_05 = "Fifth day of the month events go here.";

$event_06 = "Sixth day of the month events go here.";

$event_07 = "Seventh day of the month events go here.";

$event_08 = "Eighth day of the month events go here.";

$event_09 = "Ninth day of the month events go here.";

$event_10 = "Tenth day of the month events go here.";

$event_11 = "Eleventh day of the month events go here.";

$event_12 = "Twelth day of the month events go here.";

$event_13 = "Thirteenth day of the month events go here.";

$event_14 = "Fourteenth day of the month events go here";

$event_15 = "Fifteenth day of the month events go here";

$event_16 = "Sixteenth day of the month events go here";

$event_17 = "Seventeenth day of the month events go here.";

$event_18 = "Eighteenth day of the month events go here.";

$event_19 = "Nineteenth day of the month events go here.";

$event_20 = "Twentieth day of the month;

$event_21 = "Twenty first day of the month events go here.";

$event_22 = "Twenty second day of the month events go here.";

$event_23 = "Twenty third day of the month events go here.";

$event_24 = "Twenty fourth day of the month events go here.";

$event_25 = "Twenty fifth day of the month events go here.";

$event_26 = "Twenty sixth day of the month events go here.";

$event_27 = "This is only a test.";

$event_28 = "This is a test.";

$event_29 = "Twenty ninth day of the month events go here.";

$event_30 = "Thirtieth day of the month events go here.";

$event_31 = "Thirty first day of the month events go here.";

 

//

// Nothing is REQUIRED to be changed after this

//

 

if(${event_.$day} == "") {

$event_display = "There are no events for today.";

}

else {

$event_display = ${event_.$day};

}

 

$first_day = mktime(0,0,0,$month, 1, $year);

$title = date("F", $first_day);

$day_of_week = date("D", $first_day);

 

switch($day_of_week) {

case "Sun": $blank = 0; break;

case "Mon": $blank = 1; break;

case "Tue": $blank = 2; break;

case "Wed": $blank = 3; break;

case "Thu": $blank = 4; break;

case "Fri": $blank = 5; break;

case "Sat": $blank = 6; break;

}

function cal_days_in_month ($month, $year) {  return date('t', mktime(0, 0, 0, $month+1, 0, $year)); }

 

$days_in_month = cal_days_in_month(30, $month, $year);

?>

<h2>Trainee Parents Event Calendar</h2>

<p>

  <?

 

 

echo "<table border=\"3\" cellpadding=\"2\" cellspacing=\"4\" style=\"background: #aaa; color: #000; text-align: center\" width=\"420\">

<tr>

<td colspan=\"7\" style=\"background: #ddd; color: #00d;\"><strong>$title, $year</strong></td>

</tr>

<tr>

<td style=\"background: #eee; color: #000\" width=\"60\"><strong>Sun.</strong></td>

<td style=\"background: #eee; color: #000\" width=\"60\"><strong>Mon.</strong></td>

<td style=\"background: #eee; color: #000\" width=\"60\"><strong>Tue.</strong></td>

<td style=\"background: #eee; color: #000\" width=\"60\"><strong>Wed.</strong></td>

<td style=\"background: #eee; color: #000\" width=\"60\"><strong>Thu.</strong></td>

<td style=\"background: #eee; color: #000\" width=\"60\"><strong>Fri.</strong></td>

<td style=\"background: #eee; color: #000\" width=\"60\"><strong>Sat.</strong></td>

</tr>

<tr>

";

 

$day_count = 1;

$day_number = 1;

 

while($blank > 0) {

echo " <td></td>

";

$blank = $blank-1;

$day_count++;

}

 

while($day_number <= $days_in_month) {

if($day_number < $day) {

echo " <td style=\"background: #bbb; border: 2px solid #ccc; color: #000\"><del><em>$day_number</em></del></td>

";

}

elseif($day_number == $day) {

echo " <td style=\"background: #fff; border: 2px solid #555; color: #000\"><strong>$day_number</strong></td>

";

}

else {

echo " <td style=\"background: #ccc; border: 2px solid #ddd; color: #000\">$day_number</td>

";

}

$day_number++;

$day_count++;

 

if($day_count > 7) {

echo "</tr>

<tr>

";

$day_count = 1;

}

}

 

while($day_count > 1 && $day_count <= 7) {

echo " <td></td>

";

$day_count++;

}

 

echo "</tr>

</table>

 

<br /><hr />

 

";

 

if($enable_events == true) {

echo "<br /><strong>Events for ".$title." ".$day.", ".$year."</strong><br /><br />";

echo $event_display."<br />";

}

PHP?>

 

Link to comment
https://forums.phpfreaks.com/topic/133507-event-calendar/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.