1
感謝任何人都可以幫助! 我有下面的代碼,並且發生什麼是三個日曆正在繪製在一個選項卡上,而不是每個日曆到他們自己的選項卡上。即時通訊使用易於選項卡的jquery插件作爲參考。PHP的Jquery標籤:內容加載到一個標籤的面板
<?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;
}
}
?>
有畫日曆的代碼,這是從該代碼在這裏稱爲:
<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>";
?>
如果任何人都可以看到這個問題,我相當肯定它與做php draw_calendar()函數和我稱之爲的方式。我只是不能看到我做錯了什麼..
任何幫助將非常感激!
只是一個快速評論,在包括(」 calendar/calendar.php')是上面部分中具有完整draw_calendar()函數的代碼。 – Dooba