Calendar populated with CMS Builder records
46 posts by 12 authors in: Forums > CMS Builder
Last Post: February 27, 2012 (RSS)
Pretty nice New Year's present.
All the best,
Jerry
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Thanks to Zick and the folks at Interactive Tools, the Calendar project is moving forward nicely. I’ll be posting a revised set of files and documentation shortly.
Before I do, there's one more issue that I’d like to solve, and that’s the automatic listing of non-consecutive event dates on a detail page.
THE SCTION EDITOR
In the multi-record section called “events”, there’s a date field for the starting date (start_date), there’s a date field for the ending date (end_date) and there are 7 day of the week check boxes that determine the days on which a repeating event occurs.
Here are a few scenarios...
Using a simple if statement, if an event occurs on a single date, only the start date field would be filled in and I can show that field on my detail page.
If there’s an event that spans a number of consecutive days, both the start_date and an end_date field would be filled in and I can show those on my detail page.
THE PROBLEM
Where I’m having a problem is when an event spans a number of days, but occurs only on Tuesdays and Wednesdays (the “Tuesday” and “Wednesday” checkboxes are checked).
How can I generate a list on the detail page that shows only the Tuesdays and Wednesdays that the event occurs?
I’m thinking that the logic might be something like:
For each date in the date range between the start date and the end date, check to see if the day matches a day that is checked, and if it does, show that date.
But the coding eludes me.
Any help appreciated and I’ll include the result in the revised docs.
Thanks,
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [gkornbluth] Calendar populated with CMS Builder records
By Jason - January 3, 2011
What exactly are the names of your day checkboxes and what values are they storing?
Here is some code for looping through each of the dates one at a time. This will include the start and the end date:
<?php
$startDate = strtotime($event['start_date']);
$endDate = strtotime($event['end_date']);
$date = $startDate;
?>
<?php while($date <=$endDate): ?>
<?php $date=strtotime("+1 day",$date);?>
<?php endwhile ?>
Hope this helps get you started.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Calendar populated with CMS Builder records
A happy new year wish to everyone,
Thanks for looking at this.
The names are monday, tuesday, wednesday, thursday, etc. and the values are 1 = checked and 0 = unchecked
Thanks agan,
Jerry
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [gkornbluth] Calendar populated with CMS Builder records
By Jason - January 3, 2011
We can use the date function to get the textual day of the week for a given date. We can use this to check if a checkbox of that name has been checked.
<?php while($date <=$endDate): ?>
<?php $dayOfTheWeek = strtolower(date("l",$date)); ?>
<?php if(@$event[$dayOfTheWeek]): ?>
**OUTPUT DATE**
<?php endif ?>
<?php $date=strtotime("+1 day",$date);?>
<?php endwhile ?>
Give that a try and let me know if that works for you.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Calendar populated with CMS Builder records
Thanks for the quick reply.
At the risk of feeling dumb.
Where in Zickey's code would that go?
Thanks
Jerry
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [gkornbluth] Calendar populated with CMS Builder records
By Jason - January 4, 2011
You can use this on your detail page where ever you want to output a list of dates that your event would occur on.
Hope this helps.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Calendar populated with CMS Builder records
By gkornbluth - February 2, 2011 - edited: August 4, 2014
Hi All,
FEBRUARY 2011 CALENDAR UPDATE
It took a while, but my latest version of the Zickey Calendar files is attached.
You can see it in operation, using the files included in the attached .zip file at:
http://thecmsbcookbook.com/calendar5.php
There are test events there for February and March 2011
The detail page is straight out of the code generator so, nothing fancy.
the 2/2/11 update includes some code cleanup and re-documentation as well as a fix for the intermittent tips issue with FireFox.
Thanks to all of you who contributed to this project.
Keep those cards, letters, and suggestions coming.
Best,
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [gkornbluth] Calendar populated with CMS Builder records
By Toledoh - February 5, 2011
Does anyone else have any problems with viewing single day events?
The repeating events seem fine, but If I put in an event that has a start date, but no "day" or end date, nothing shows.
Tim (toledoh.com.au)
Re: [Toledoh] Calendar populated with CMS Builder records
On the test page at: http://www.thecmsbcookbook.com/calendar5.php
Event 5 is a single day event (Feb 3). I can see it in both FF3.6 and IE8.
If you can see that one, then the issue is probably an errant character in your code.
Best,
Jerry
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php