Solved

How would I implement this full calendar jquery plugin ?

Posted on 2014-12-22
7
540 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
  • 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now