Events Diary Creation

8 posts by 3 authors in: Forums > CMS Builder
Last Post: June 4, 2009   (RSS)

By willydoit - May 28, 2009 - edited: May 28, 2009

Hi,

I started off creating an events diary with little experience of CMS builder as I thought it would be pretty straightforward, select a month and produce a list showing events during that month based on the date search, sounds fine however I have already run into a few issues such as;

a) catering for events which for example are only on specific days between certain dates, I would somehow wish to have these recuring listings automatically displayed in the diary list without having to manually add them.ie If an event took place every thursday during May I would want that item to appear in the list for each Thursday in May. This to me sounds very complex and If I cannot achieve this pretty simply then I think I would be better off just using our existing web calendar program but I would much prefer to have it all within cms builder if possible. Can this be done?

b) If an event starts in April and runs until July I would wish to ensure that searches for events in May and June also showed the event details. I have an event date variable called 'event_date' and have used an end date variable of 'removeDate' , at present my code below simply checks the event_date and if it matches the search month then it will display.

Could someone advise how I would amend this code to display if the search month fell between the 'event_date' and the 'removeDate' which would presumable provide the solution to b) above, sorry if this is elementary stuff but have to start somewhere. Have also come across another issue of where events are only for one day, to prevent removal of the event on the day it occurred I would somehow need to advance the removeDate to the following day or not to remove until midnight of that date. (two steps forward three steps back [unsure])

If you could advise if the whole process is likely to be too complex to achieve it would be appreciated.

Code below

<form method="post" action="diarylist.php">

<table border="0" cellspacing="0" cellpadding="0">

<tr>
<td colspan="2"><br />

<br />
<select name="event_date_month">
<option value="">&lt;Please Select Month&gt;</option>
<option value="">List all Events</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>

</select>
&nbsp;
</p> </p> </td>

</table><br/>


<div align="center">
<input type="submit" name="search" value=" List Events "/>

Re: [willydoit] Events Diary Creation

By ross - May 29, 2009

Hi there.

Thanks for posting!

For the first one there, I think we'll need to look at some customized options which we can do through consulting@interactivetools.com

For the second one, if you were to setup a special field for end dates in your event section, the system itself would just stop displaying that listing after a certain point in time. So the listing would appear in your search until it has "expired".

Check out this page in our docs for a bit more information:


http://www.interactivetools.com/docs/cmsbuilder/special_fieldnames.html


You'll be looking at the "removeDate" field. I also recommend adding in a "neverRemove" field just so you don't actually have to set a date for every single listing.

LEt me know what you think :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] Events Diary Creation

By willydoit - May 29, 2009

Hi Ross,

Sorry, I must not have made myself clear, I have already set up an end date by using the removeDate field as stated in b), my issue was that if the event started in April and ran until say August I need the item to also show in May , June , July and August searches, the coding I have would only show the item in May as it searches on the start date field if startdate = 5 then it shows on a may search, on a june search it would not show up as startdate doesnt=6 I assume I need something such as if start date is equal to or greater than search date and search date is less than removeDate then display plus any other elements to stop false displays, does this help?

Thanks

Re: [willydoit] Events Diary Creation

By ross - June 1, 2009

Hi.

Thanks for clearing that up! I think I get it now :). The auto hide thing will definitely help but you'll need to take it one step further.

Basically, you are passing the month numbers to your server so you'll need to setup a custom WHERE to search something like this:

where the event month number is less that the end date selected in the form.

Does that sound more like it?

Let me know what you think :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [willydoit] Events Diary Creation

By Dave - June 1, 2009

Hi willydoit,

Try this:
- Rename your search field 'targetDate'
- Zero pad the month numbers so they are all 2 digits (and Mar is 03)
- Change the values to be like this: 2009-03, use <?php echo date('Y'); ?> to display the current year.

That will give us a valid mysql date we can use for comparison. Then above your code block have this line:
$escapedTargetDate = mysql_real_escape_string( $_REQUEST['targetDate'] );

Then in your list viewer options have this:
'where' => "startdate <= '$escapedTargetDate' AND '$escapedTargetDate' <= removeDate",

That will let you search for a month that is within the range. In general, though, date and calendar systems are _very_ complicated. I've done a few through custom programming and just figuring out how to display things in a way that makes sense is enough of a challenge before you even get to the programming. The issue is all the different combination of dates (some are on certain days only, some are re-occurring, etc).

For simple event lists CMS Builder is great but if you find you want to do something more advanced you're be better off with a pre-made web-calendar system or something custom built.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Events Diary Creation

By willydoit - June 2, 2009

Thanks Dave,

If you think it could be complex then without doubt it is going to be beyond my current knowledge, I think we may have to stick with the current calendar program which looks naff or look for an alternative which uses php & css so way may be able to adapt it to fall in line with current design layouts.

Thanks for your help

Re: [willydoit] Events Diary Creation

By ross - June 4, 2009

Hi there.

Keep us up to date with however you end up getting things done. If you like, we could take a look at this for you through consulting but like Dave said, it would still end up being a fairly simple events list.

Either way, keep us up to date :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/