Dank an alle, die Ihnen helfen können! Ich habe den folgenden Code, und was vorkommt ist, dass drei Kalender auf einer Registerkarte, anstatt jeden Kalender auf eine eigene Registerkarte gezeichnet werden. Ich benutze das easy-tabs jquery plugin als Referenz.PHP Jquery Tabs: Inhalt lädt in eine Registerkarte
<?php
if(!function_exists('draw_calendar')){
function draw_calendar($month,$year,$day1,$lTaught1,$tutorid,$stuEmail,$timeStart,$timeEnd,$cost,$date,$count1){
switch($lTaught1){
case "eng":
$language = "English";
break;
case "oth":
$language = "Other";
break;
case "chi":
$language = "Chinese";
break;
};
if($count1 ==2){
echo"helo";
}
/* draw table */
$calendar = '<div id="tabs'.$count1.'-html"><div id="calendar-wrapper">';
/* table headings */
$calendar.= '<div id="weekday"><ul>
<li>Sunday</li>
<li>Moday</li>
<li>Tuesday</li>
<li>Wednesday</li>
<li>Thursday</li>
<li>Friday</li>
<li>Saturday</li>
</ul></div><div id="calendar">';
/* days and weeks vars now ... */
$running_day = date('w',mktime(0,0,0,$month,1,$year));
$days_in_month = date('t',mktime(0,0,0,$month,1,$year));
$days_in_this_week = 1;
$day_counter = 0;
$dates_array = array();
/* row for week one */
$calendar.= '<ul class="days">';
/* print "blank" days until the first of the current week */
for($x = 0; $x < $running_day; $x++):
$calendar.= '<li class="day other-month"></li>';
$days_in_this_week++;
endfor;
/* keep going with days.... */
for($list_day = 1; $list_day <= $days_in_month; $list_day++):
/* add in the day number */
if($day1 == $list_day && $status="available"){
$calendar.= '<li class="day">';
$calendar .= '<div class="date">'.$list_day.'</div>';
$calendar .= '<div class="event"><a href="registerSession.php?tutorid='.$tutorid.'&email='.$stuEmail.'×tart='.$timeStart.'&timeend='.$timeEnd.'&cost='.$cost.'&date='.$date.'">Book this</a></div>';
} else {
$calendar.= '<li class="day">';
$calendar.= '<div class="date">'.$list_day.'</div>';
}
$calendar.= '</li>';
if($running_day == 6):
$calendar.= '</ul>';
if(($day_counter+1) != $days_in_month):
$calendar.= '<ul class="days">';
endif;
$running_day = -1;
$days_in_this_week = 0;
endif;
$days_in_this_week++; $running_day++; $day_counter++;
endfor;
/* finish the rest of the days in the week */
if($days_in_this_week < 8):
for($x = 1; $x <= (8 - $days_in_this_week); $x++):
$calendar.= '<li class="day other-month"></li>';
endfor;
endif;
/* final row */
$calendar.= '</ul>';
/* end the table */
$calendar.= '</div></div>';
/* all done, return result */
return $calendar;
}
}
?>
ist der Code, den Kalender zu ziehen, die mich aus diesem Code hier genannt wird:
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="robots" content="index,follow">
<meta name="viewport" content="width=device-width, initial-scale=1.0" >
<title>Vesta | <?php echo $fname ?></title>
<script src="calendar/vendor/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="calendarvendor/jquery.hashchange.min.js" type="text/javascript"></script>
<script src="calendarlib/jquery.easytabs.min.js" type="text/javascript"></script>
<link href="css/1140.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,700' rel='stylesheet' type='text/css'>
<link href="calendar/style.css" rel="stylesheet" type="text/css">
<style>
/* Example Styles for Demo */
.etabs { margin: 0; padding: 0; }
.tab { display: inline-block; zoom:1; *display:inline; background: #eee; border: solid 1px #999; border-bottom: none; -moz-border-radius: 4px 4px 0 0; -webkit-border-radius: 4px 4px 0 0; }
.tab a { font-size: 14px; line-height: 2em; display: block; padding: 0 10px; outline: none; }
.tab a:hover { text-decoration: underline; }
.tab.active { background: #fff; padding-top: 6px; position: relative; top: 1px; border-color: #666; }
.tab a.active { font-weight: bold; }
.tab-container .panel-container { background: #fff; border: solid #666 1px; padding: 10px; -moz-border-radius: 0 4px 4px 4px; -webkit-border-radius: 0 4px 4px 4px; }
.panel-container { margin-bottom: 10px; }
</style>
<script type="text/javascript">
$(document).ready(function() {
$('#tab-container').easytabs();
});
</script>
</head>
<body>
<div class="container12">
<?php include "nav.php"; ?>
</div>
<div class="wrapper">
<?php
$sql2 = "SELECT timeStart, timeEnd, dateFor, languageTaught, cost, status FROM tutorslots WHERE tutorid='$tutorid'";
include('calendar/calendar.php');
$result2 = mysqli_query($conn,$sql2);
$result3 = mysqli_query($conn,$sql2);
if (!$result2) {
echo 'MySQL Error: ' . mysqli_error();
exit;
}
$count = 1;
echo "<div id='tab-container' class='tab-container'>";
echo "<ul class='etabs'>";
while ($row3=mysqli_fetch_assoc($result3)){
echo "<li class='tab'><a href='#tabs".$count."'>HTML Markup</a></li>";
$count++;
}
echo "</ul>";
$count1 = 1;
echo "<div class='panel-container'>";
while ($row2 = mysqli_fetch_assoc($result2)) {
$timeStart = $row2["timeStart"];
$timeEnd = $row2["timeEnd"];
$date = $row2["dateFor"];
$languageTaught = $row2["languageTaught"];
$status = $row2["status"];
$cost = $row2["cost"];
$dateElements = explode('-', $date);
$year1 = $dateElements[0];
$mo = $dateElements[1];
$day1 = $dateElements[2];
$lTaught1 = $languageTaught;
echo "<h1>".$date."</h1>";
echo "<br>";
echo draw_calendar($mo,$year1,$day1,$lTaught1,$tutorid,$stuEmail,$timeStart,$timeEnd,$cost,$date, $count1);
$count1 ++;
}
echo '</div>';
echo "</div>";
?>
Wenn jemand das Problem sehen kann, bin ich ziemlich sicher, dass es mit der zu tun hat, php draw_calendar() Funktion und die Art, wie ich es nenne. Ich kann nur nicht sehen, was ich falsch mache ..
jede Hilfe würde sehr geschätzt werden!
nur ein kurzer Kommentar, die include (‘ calendar/calendar.php ') ist der Code im obigen Abschnitt, der die volle Funktion draw_calendar() hat. – Dooba