Welcome Guest, Not a member yet? Register   Sign In
CI + JSON + FullCalendar
#4

[eluser]cahva[/eluser]
Ehm.. Its the same link than before. The only difference is that you print the json straight from controller and do not use view. For example:

Model
Code:
function jsonEvents ()
{
    $this->db->order_by('startDate', 'desc');
    $this->db->limit(10);
    $events = $this->db->get('calendar')->result();
    
    $jsonevents = array();
    foreach ($events as $entry)
    {
        $jsonevents[] = array(
            'id' => $entry->eventID,
            'title' => $entry->eventTitle,
            'start' => $entry->startDate,
            'allDay' => false,
            'end' => $entry->endDate
        );
    }
    return json_encode($jsonevents);
}

controller
Code:
function json()
{
    header("Content-Type: application/json");
    echo $this->events_model->jsonEvents();
}


Messages In This Thread
CI + JSON + FullCalendar - by El Forum - 05-05-2011, 04:05 PM
CI + JSON + FullCalendar - by El Forum - 05-05-2011, 05:32 PM
CI + JSON + FullCalendar - by El Forum - 05-05-2011, 09:10 PM
CI + JSON + FullCalendar - by El Forum - 05-06-2011, 04:34 AM
CI + JSON + FullCalendar - by El Forum - 08-01-2012, 11:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB