Google calendar is a very useful calendar service. It is easy for web programmers to interact with this calendar. You can use simple techniques like embedding calendars on your site. You can also interact on an entirely different level by using PHP and the google API's. Zend Framework provides a good place for the beginning and advanced PHP programmer to make this connection.
Edit Steps
- 1We are going to be using Zend Framework to do much of the programming for us. So the first step is to get send framework and install it in the directory on your site where the pages will be located. So go to Zend link below and download the framework: Zend Framework DownLoad. Once you have downloaded this package upload it to the directory where you will be creating the web pages that you will use to access Google calendar.
- 2Next step is for you determine the url of your calendar. In these examples I am going to be using a public calendar created on Google. It is also possible to use a private calendar as you will be authenticating via your PHP interface. Once you have created a Google calendar you can go to the calendar's individual setting page and you will find an entry showing the calendar address;It looks like - Calendar ID: [email protected]
- 3Now you are ready to build the PHP page to connect to your calendar.
- This code shows the classes you need and loads them.
- Next you need some basic functions that will you need to access events and search for events and then update those events. First here is the code for updating events .
- You also need a function updating events.
- Last is the function that is the backbone and allows you to pass parameters to it then are you changes to the calendar and the original calendar events.
EditCode Explained
- 1You will see where we placed the Calendar id in the setUser statements in both the getEvent() Function and in the update_google() Function.
- 2The function 'update_google()' contains four parameters that are passed. The first three identify the entry title of the old and new entry and the fourth term identifies the date.
- 3Since I am using a title that changes 'preffix' (in this case the old being the second term and the new one being the third term) but keeps the same main term (the third term) I send three parameters to the function to define them.
- 4The fourth term is the date to be searched for. Since I am searching for items that are entire day (i.e. not time specific) I have first calculated the next day to use in the min and max settings of the query.
Edit Related wikiHows
Edit Sources and Citations
My jumping off point for the code here is from Integrate your PHP application with Google Calendar - PHP tutorial. Although very well written it is still a little bit of a hard place for the beginning PHP programmer to start. You also need to look at Google's site on this topic: Google API and php