Solution to get the next event data
-
Hi,
I am looking for a simple solution to get the next event of the calendar. I mean the date, the title, the location, the details…
I don’t know how the Google Calendar API works, I only used it through wordpress and this plugin.
What I need is a function called from the plugin or somewhere else (in that case there should be a kind of connection to the calendar) and that returns the next event. For example as a map with all the fields as keys/values/
For the moment, I have a script that parses the DOM and looks for the last cell whose classes contains “gce-has-events”. And then I extract the data I need. That works well but have two major drawbacks:
– the maintenance is not safe. The day the plugin is updated and the HTML changes (elements disposition, classes…), the script will not work anymore
– if in the current month (I have chosen the month view) there is no event, the script is unable to find the next event. To deal with that case, I copied some pieces of code in the plugin : the ones that are called on a click on the “next month” button. Of course I don’t update the view, I only uses the HTML that should be displayed to get the data I need. And I do that month after month until I find an event (by the way, I should think about the case there is no event at all in the calendar. There would be an infinite loop for the moment. :/). Anyway, that way to do is acceptable for the current month, but absolutely horrible with that “click on the next month button” simulation. The code is hard to understand and it’s a nightmare to maintain after every update. Indeed, the developpers often modify that part of the code so I have to do the same and remember how my horrible script works…My question is: is there a more simple way to get the next event data? Something nice and easy to maintain.
Thank you ??
- The topic ‘Solution to get the next event data’ is closed to new replies.