Location of JSON file within CodeIgniter for use as eventSource with fullCalendar jQuery plugin

Posted on 2014-03-13
Medium Priority
Last Modified: 2014-03-13
I am trying to generate some JSON to store information about calendar events for use in the fullCalendar jQuery plugin.  The plugin documentation provides that the calendar is able to fetch events from a JSON feed:


    eventSources: [

        // your event source
            url: '/myfeed.php', // use the `url` property
            color: 'yellow',    // an option!
            textColor: 'black'  // an option!

        // any other sources...



Open in new window

My question is:  Where does the myfeed.php file go if I am using CodeIgniter?  If I put the file off the root of the site as in `http://mysite/myfeed.php` then I am not able to query the database, presumably because the file is outside of the CodeIgniter application folder.  If the myfeed.php file needs to be inside the CodeIgniter application folder, then where does it go and how do I modify the URL parameter above to reflect the new location?

Question by:DanielAttard
  • 2

Accepted Solution

DanielAttard earned 0 total points
ID: 39928314
The answer to this question I discovered by realizing that it was not a "view" that needed to be loaded, but rather it was simply a calculation, or method, if you will. All I had to do was to move the calculation code that was in myfeed.php and put it into a controller and then a method. After I did that, it was simply a matter of updating the url parameter as follows:

eventSources: [
    url:  '/myController/myMethod',  <-- THIS WORKS !!
    color: '#DBBE00',     
    textColor: '#000000' 
theme: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
editable: false

Open in new window

Happy to report that I managed to figure this one out myself.

Author Closing Comment

ID: 39928316
Solved this problem on my own.  </BackPatting>

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question