Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: n-joy on October 01, 2012, 04:45:34 PM

Title: [SOLVED][CALENDAR] Data from two tables
Post by: n-joy on October 01, 2012, 04:45:34 PM
Hi there, I'm facing the following problem:

-I have two tables with events.
->One contains the regular, standard events such as birthdays and holidays.: id_event, start_date, end_date, title, ...
->The other one contains a list with summer camps: id_camp, start_date, end_date, title ...

I want them both to show up at the calendar.

Is there any (easy) way to achieve this? Basic data, such as start and end date are in the same format. I just need to join those tables somehow. However, I don't want to put the summer camps into the standard event list. I need them seperated.

Any help would be appreciated! Thanks in advance.  :)
Title: Re: [CALENDAR] Data from two tables
Post by: n-joy on October 02, 2012, 02:04:39 PM
Bump.  :)
Title: Re: [CALENDAR] Data from two tables
Post by: Kindred on October 02, 2012, 04:12:31 PM
short answer... NO. There is no easy way to do this.

You would have to write your own code -- and re-write the calendar code, fairly significantly, I would think...
Title: [SOLVED][CALENDAR] Data from two tables
Post by: n-joy on October 02, 2012, 07:10:30 PM
Quote from: Kindred on October 02, 2012, 04:12:31 PM
short answer... NO. There is no easy way to do this.

You would have to write your own code -- and re-write the calendar code, fairly significantly, I would think...

Thanks for your reply. :)
I found a workaround for my problem. I will mark this thread as solved.
Title: Re: [SOLVED][CALENDAR] Data from two tables
Post by: Kindred on October 02, 2012, 09:08:36 PM
I am glad you found a solution. Care to share in case anyone else needs to do something similar?
Title: Re: [SOLVED][CALENDAR] Data from two tables
Post by: n-joy on October 03, 2012, 07:14:30 AM
It's not a perfect solution, but it does the job.
I added another column in the smf_event table, indicating the type of an event with an integer.
Then I modified Subs_Calendar.php and made the system do a check for that integer before extracting the data it needs.
The integer refers to the table we want to extract data from. :)