> Would you mind posting your PHP code on the wiki?  Maybe even your table
> schema (although that might not be necessary.)   I can help (or post it
> for you) if you like.
>
> I would like to document how to get data from PHP/MySQL to input data
> streams for Timeline, Exhibit, and Timeplot.

I'm not sure how much sense this code will make to folks, but here's
one of the key functions we're using. Some of this is hardcoded at the
moment- it's still in flux and changing daily, but I think this will
give people a starting point.

    function jsonize($events) {
        $data = array();
        foreach ($events as $event) {
            $d = array();
            foreach ($event as $key => $val) {
                array_push($d, sprintf("'%s' : '%s'", $key, $val));
            }
            array_push($data,"\n{" . implode(',', $d) . "}\n");
        }
        $rtn = sprintf("%s",implode(',',$data));
        return $rtn;
    }
    function get_events() {

        $rtn = <<<EOT
{
    'dateTimeFormat' : 'iso8601'
    , 'wikiURL' : 'http://simile.mit.edu/shelf'
    , 'wikiSection': "Simile Cubism Timeline"
    , 'events' : [
EOT;

    $rtn .= $this->jsonize($this->events);

    $rtn .= <<<EOT
    ]
    }
EOT;
        return $rtn;
    }
--~--~---------~--~----~------------~-------~--~----~
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