Hi Hanif,

The best way to debug simile widgets applications is to install firebug and
monitor the errors that the application is generating. This will give you
some headway on what is not right.

On another note, your json data does not look right. Here is the data i use
to plot on timeline, which plots fine. http://pastebin.com/aqTEAZMn

Regards
Kihara Absolomon :: Software Developer :: Movert  Technologies ::
http://soloincc.movert.co.ke/
-----------------------------------------------------------------------------------------------------------------------------------------------
"Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning." – Rick Cook



On Sat, Apr 21, 2012 at 9:12 PM, Hanif Fikri <[email protected]> wrote:

> hey everyone, so i try to load data from mysql to timeline using
> jsonized.php as shown in code below:
>
> <?php
> header('Content-Type: application/json; charset=utf-8');
> /*
>  * @Purpose: This file is about making JSON data
>  * @author : goldsky
>  * @date   : 20100210
>  */
> // Database settings (localhost? username? password?)
> include_once('connect.php');
>
> // generating event attributes inside a function
>
> function eventAtt() {
>   $eventQuery=mysql_query("select nama, nama_prodi, perusahaan, dept,
> job, kota, sdate, edate, coorx, coory from alumni, pekerjaan, prodi
> where alumni.nim=pekerjaan.nim and alumni.id_prodi=prodi.id_prodi")
> or die (mysql_error());
>   while ($row = mysql_fetch_array($eventQuery)) {
>       $date = explode("-", $row['sdate']); // in my case, $date is
> stored as yyyy-mm-dd in MySQL table.
>       $phpmakedate = mktime(0, 0, 0, $date[1], $date[2], $date[0]);
>       // ------------ optionally with "end" date ------------
>       if ($row['edate']== NULL || $row['edate'] == '0000-00-00') {
>           $phpenddate = NULL;     // to skip latestStart date
>           $durationEvent = FALSE; //JSON
>       }
>       else {
>           $enddate = explode("-", $row['edate']);
>           $phpmakeenddate = mktime(0, 0, 0, $enddate[1], $enddate[2],
> $enddate[0]);
>           $phpenddate = date("r",$phpmakeenddate);
>           $durationEvent = TRUE; //JSON
>       }
>       // ------------ create the array here ------------
>       $eventAtts[] = array (
>               'start' => date("r",$phpmakedate),
>               'end' => $phpenddate,
>               'durationEvent' => $durationEvent,
>               'description' => $row['nama']
>       );
>   }
>   mysql_free_result($eventQuery);
>   return $eventAtts;
> }
>
> ////////////////////////////////////////////
> //                                        //
> //          TIMELINE'S JSON DATA          //
> //                                        //
> ////////////////////////////////////////////
> //
> $json_data = array (
>        //Timeline attributes
>
>        'wiki-url'=>'http://simile.mit.edu/shelf',
>        'wiki-section'=>'Simile Cubism Timeline',
>        'dateTimeFormat'=>'Gregorian', //JSON!
>        //Event attributes
>        'events'=> eventAtt() // <---- here is the event arrays from
> function above.
> );
> $json_encoded=json_encode($json_data);
> echo $json_encoded;
> ?>
>
>
> by excecuting the above file, i have the result like this: which i
> think it is correct...
>
> {"wiki-url":"http:\/\/simile.mit.edu\/shelf","wiki-section":"Simile
> Cubism Timeline","dateTimeFormat":"Gregorian","events":[{"start":"Wed,
> 21 Sep 2011 00:00:00
> +0800","end":null,"durationEvent":false,"description":"John Dhoe"}]}
>
>
> but some how i still cannot load this data to my timeline, i wrote
> this codes to display the data:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
>  "http://www.w3.org/TR/html4/strict.dtd";>
> <html>
> <head>
>   <!-- See http://developer.yahoo.com/yui/grids/ for info on the grid
> layout -->
>   <title>Local Timeline Example</title>
>   <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /
> >
>
>   <!-- See http://developer.yahoo.com/yui/ for info on the reset,
> font and base css -->
>
>
>   <!-- Load the Timeline library after reseting the fonts, etc -->
>  <script src="http://api.simile-widgets.org/timeline/2.3.1/timeline-
> api.js?bundle=true" type="text/javascript"></script>
>
>
>
>   <!-- Since we don't have our own server, we do something tricky and
> load our data here as if it were a library file -->
>   <script src="jsonized.php" type="text/javascript"></script>
>
>   <script>
>
>
>  function onLoad() {
>  var eventSource = new Timeline.DefaultEventSource();
>
>   var bandInfos = [
>     Timeline.createBandInfo({
>         width:          "70%",
>         intervalUnit:   Timeline.DateTime.DAY,
>         intervalPixels: 100
>     }),
>     Timeline.createBandInfo({
>         width:          "30%",
>         intervalUnit:   Timeline.DateTime.MONTH,
>         intervalPixels: 200
>     })
>   ];
>
>   bandInfos[1].syncWith = 0;
>   bandInfos[1].highlight = true;
>
>    tl = Timeline.create(document.getElementById("xxx"), bandInfos);
>   tl.loadJSON("jsonized.php?"+ (new Date().getTime()), function(json,
> url) {
>   var url=".";
>       eventSource.loadJSON(json, url);
>   });
>
>  }
>
>  var resizeTimerID = null;
>  function onResize() {
>     if (resizeTimerID == null) {
>         resizeTimerID = window.setTimeout(function() {
>             resizeTimerID = null;
>             tl.layout();
>         }, 500);
>     }
>  }
>
>   </script>
>
> </head>
> <body onload="onLoad();" onresize="onResize();">
> <div id="xxx" style="height: 150px; width:800px; border: 5px solid
> #aaa"></div>
>
>
> </body>
> </html>
>
>
> Please help :')
>
> --
> You received this message because you are subscribed to the Google Groups
> "SIMILE Widgets" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/simile-widgets?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en.

Reply via email to