Solved

How would I implement this full calendar jquery plugin ?

Posted on 2014-12-22
7
626 Views
Last Modified: 2014-12-22
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
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40513747
Are you using PHP?
If so you can use json_encode() to change an array to a json string
0
 

Author Comment

by:NeverEndingFlashStories
ID: 40513778
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
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 250 total points
ID: 40513808
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 58

Assisted Solution

by:Gary
Gary earned 250 total points
ID: 40513822
json_encode turns an array into a string ergo you just echo it or as Cd& says dump the array
0
 

Author Closing Comment

by:NeverEndingFlashStories
ID: 40513862
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40513958
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
 

Author Comment

by:NeverEndingFlashStories
ID: 40514166
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn how to count occurrences of each item in an array.

734 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