Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 728
  • Last Modified:

How would I implement this full calendar jquery plugin ?

Hi,

I am trying to implement the following plugin :

http://fullcalendar.io/

I am a beginner level web developer, with very minimum familiarity with any of the web languages. That said,

the example given seems to have the value of the events (title, start date, end date) hard coded as a property.
Here is an example :
http://fullcalendar.io/docs/event_data/Event_Source_Object/

There are a few other ways to apparently populate the events, but the author only gives the hardcoded example, and the json example.

I have a mySQL events table that i'd like to use to populate the calendar, however, i am not sure how to proceed.

Ideally, i'd like to just use PHP to pull the events into an array, and then use javascript to populate the events. But this doesn't seem like its possible. The author mentions an event generating function (see link), but it doesn't seem to be one that takes an array.

Is json my only viable option? I will have to figure out how to write a php code to write into a .json file.

Thanks!
0
NeverEndingFlashStories
Asked:
NeverEndingFlashStories
  • 3
  • 2
  • 2
2 Solutions
 
GaryCommented:
Are you using PHP?
If so you can use json_encode() to change an array to a json string
0
 
NeverEndingFlashStoriesAuthor Commented:
Hi Gary,

Thanks! in fact, i am looking at the code right now to try and figure out how he did it, and i think he did the exact same thing.
However, I can't output the result of his json_encode() to see what a sample array would look like.

Basically, in the main calendar.php, he initialized the calendar this way :

 $('#calendar').fullCalendar({
events: {
				url: 'php/get-events.php',
}
});

Open in new window


Now, in the get-events.php, he read a .json file using json_decode, and then at the end of the php file, he did a :

echo json_encode($output_arrays);

Open in new window


So, i figure, all i need is to create a similar array, make my own get-events.php, and return my own json_encode.
Except , i don't know how it should look like. So i tried doing a

print_r($output_arrays);

at the end of the get-events.php, but the whole thing crashed instead, giving me an error message that php/get-events.php must be running.

Any idea how i can take a look at what his json_encode output look like?  Am i using the right command (print_r?)

Thanks
0
 
COBOLdinosaurCommented:
Use var_dump($output_arrays) instead. that will give you the structure and content.

I have some concern with:
I am a beginner level web developer, with very minimum familiarity with any of the web languages.

You may be putting yourself on a rocky deadend road, if you don't take the time to learn basic skills before moving up to things like jquery.  The time it takes to learn the basics of webdev technologies is a lot less than the time you will spend bang your head on the wall trying work with something where you have a problem where you need to understand what is going on beneath the abstraction tool you are working with.

Cd&
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
GaryCommented:
json_encode turns an array into a string ergo you just echo it or as Cd& says dump the array
0
 
NeverEndingFlashStoriesAuthor Commented:
Thanks.
I am in the enviable position of inheriting someone else's 3 web dev projects - so, I am looking at web sites created with combinations of js, jquery, ajax, php, html, mysql, css and sass all at once, with a deadline :).

While I have beginner level books thrown around on the floor for all of these languages, its as you said, really difficult to make all the different syntax stick in all at the same time.

At moments like these i am grateful for sites like this.
0
 
COBOLdinosaurCommented:
Sounds like you got a load of ugly dumped on you... Did you do something to make the boss angry?

Learning on the fly is an option. for the position you are in the best advice I can give you is to try and simplify where you can, and document what you are doing so you don't end up asking yourself "why did I do that?".

The second best advice you already know... bookmark EE.

Cd&
0
 
NeverEndingFlashStoriesAuthor Commented:
Haha. Budget cuts. At least I still have a job!
Thanks for the advice - I'll be showing up quite a bit on this site for the next couple months, I am sure!

Cheers
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now