|  | 
	                
  
    | 
	 
        สอบถามเรื่องการดึงข้อมูลมาแสดงใน fullcalendar-2.1.1 มีปัญหาเวลาไม่แสดงครับ     |  
    |  |  
 
	
		|  |  |  |  |  
		|  |  | 
          
            | พอดีดึงข้อมูลมาแสดงใน fullcalendar-2.1.1 ครับ แต่มันแสดงแต่ title ไม่แสดง เวลาอ่ะครับ 
 
  
 
 data_events.php
 
 header("Content-type:text/json; charset=UTF-8");       
header("Cache-Control: no-store, no-cache, must-revalidate");         
header("Cache-Control: post-check=0, pre-check=0", false);    
$con_db=mysql_connect("mysql.hostinger.in.th","u467800536_bus","123456") or die("Cannot connect db server");
$select_db=mysql_select_db("u467800536_bus");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
if($_GET['gData']){  
    $sql="SELECT * FROM tbl_event WHERE date(event_start)>='".$_GET['start']."'  ";  
    $sql.=" ORDER by event_id";  
    $qr=mysql_query($sql);
    while($rs=mysql_fetch_object($qr)){
        $json_data[]=array(  
            "id"=>$rs->event_id,
            "title"=>$rs->event_title,
            "start"=>$rs->event_start,
           
            "url"=>$rs->event_url,
            "allDay"=>($rs->event_allDay==true)?true:false      
        );    
    }  
}
$json= json_encode($json_data);  
if(isset($_GET['callback']) && $_GET['callback']!=""){  
echo $_GET['callback']."(".$json.");";      
}else{  
echo $json;  
}
 
 calendar.php
 
 <html lang="en">
<head>
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Bootstrap, a sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.">
<meta name="keywords" content="HTML, CSS, JS, JavaScript, framework, bootstrap, front-end, frontend, web development">
<meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
<meta name="format-detection" content="telephone=no">
<title>Calendar</title>
<link rel="stylesheet" href="js/fullcalendar-2.1.1/fullcalendar.min.css">
<style type="text/css">  
#calendar{  
    width:750px;      
    margin:auto;  
}  
</style>    
</head>
<body>
<div class="wrapper">
<div class="container p-t-60 p-b-10 bg-w ">
<div class="row">
<div id="calendar"></div>  
</div>
</div>
</div>	
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>    
<script type="text/javascript" src="js/fullcalendar-2.1.1/lib/moment.min.js"></script>
<script type="text/javascript" src="js/fullcalendar-2.1.1/fullcalendar.min.js"></script>
<script type="text/javascript" src="js/fullcalendar-2.1.1/lang/th.js"></script>
<script type="text/javascript">  
$(function(){
    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',  
            center: 'title',
            right: 'month,agendaWeek,agendaDay',
        },  
        events: {
            url: 'data_events.php?gData=1',
            error: function() {
            }
        },    
        eventLimit:true,
        lang: 'th'
    });
     
});
</script>  
</body>
</html>
 
 อันนี้เป็น code ใน 2 ไฟล์ที่ใช้งานครับ
 
 
 
 Tag : PHP, MySQL
 
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2015-02-27 02:02:22 | By :
                          tonyxx25925 | View :
                          3462 | Reply :
                          4 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |  
		|  |  |  |  |  
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | "start"=>$rs->event_start,
 event_start - ชื่อตรงกับฐานข้อมูลหรือเปล่าครับ ถ้าตรงเวลาที่อยู่ในฟิลด์จะต้องแสดงแน่นอนครับ
 Show Example
 
 เพิ่มเติมที่ผมใช้อยู่ ใช้งานร่วมกับ Fancybox
 
 
<script type="text/javascript">
jQuery( document ).ready(function() {   
      var currentLangCode = 'th';
      $('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },          
            eventLimit: true, // allow "more" link when too many events
            defaultDate: new Date(),
            lang: currentLangCode,
			timezone: 'Asia/Bangkok',
            events: {
            url: 'data_events.php',
         	},  
            loading: function(bool) {
                $('#loading').toggle(bool);
            },
			
			eventClick: function(event) {
    if (event.url) {
      $.fancybox({
        		'href' : event.url,
        		'type' : 'iframe',
				'autoScale'     	: false,
				'openEffect' : 'elastic',
        		'openSpeed'  : 'fast',
                'closeEffect' : 'elastic',
        		'closeSpeed'  : 'fast',
				'closeBtn'  : true,
				onClosed	:	function() {
					parent.location.reload(true); 
				},
				helpers : {
					thumbs : {
						width  : 50,
						height : 50
					},
					
					overlay : {
            				css : {
                				'background' : 'rgba(49, 176, 213, 0.7)'
           			 }
       				 }
				}
            });
      return false;
    }
  },
			
		
        });
    });
</script>
 |  
              | 
 ประวัติการแก้ไข
 2015-02-27 09:50:51
 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2015-02-27 09:47:29 | By :
                            apisitp |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณมากเลยครับ เดี๋ยวไปลองดูครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2015-02-28 07:14:48 | By :
                            tonyxx25925 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ผมว่าชื่อมันก็ตรงนะครับ หรือผมดูผิด 
 
  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2015-02-28 07:18:38 | By :
                            tonyxx25925 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | เดาว่าตรง event_end ต้องมีค่าด้วยครับ ไม่งั้นระบบมันจะคิดว่ามีกิจกรรมทั้งวัน หรือ ไม่ตรงตามระบบ... 
 ลองเพิ่ม event_end ให้สอดคล้องตามความเป็นจริงดูครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2015-03-02 10:26:17 | By :
                            apisitp |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |