Jump to content

Recommended Posts

howdy everyone,

 

    So I am trying to generate an event calendar for my organization as our calendar.  I have built calendars in the past, but I am having a hard time taking those applications and marrying them into my new need.  My prior calendars where strictly dates.  I could construct this by hand, setting variables for each day and month, but with the power of PHP there has to be a better way.  Obviously I need to generate dynamically a calendar, but with in the day, be it in the <td> tags or however it is constructed, I would like it to fill it with events that I have in table.  The dates are stored as yyyy-mm-dd in the table so they should be easy enough, but I really just do not have a solid idea of how I can get it to echo the event's title and location in each day where the date on the cal matches the date on the event.  Also, shifting to prior and next months would be killer too.  If anyone has any ideas as to where I should start on this, please let me know.  Thanks and have a great day. 

Link to comment
https://forums.phpfreaks.com/topic/82393-generating-an-event-calendar/
Share on other sites

I've written a calendar that does what you're asking for.  Basically you first generate the calendar table.  Afterwards add the code that queries a table for all events whose beginning timestamp and ending timestamp contain the date currently being generated.

Here is a decent start to building the calendar

 

http://php.about.com/od/finishedphp1/ss/php_calendar.htm

 

Once you do that, what I did was build an array for the month with all the events, the first index being the day, and just looped through the events for the day and printed them in the TD field.  I can show you the result if you like.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.