adding a calendar?

11 posts by 3 authors in: Forums > CMS Builder
Last Post: September 2, 2009   (RSS)

By sandisturm - January 29, 2008

Is it possible to create a calendar that is updateable through the CMS Builder?

Re: [sandisturm] adding a calendar?

By Dave - January 29, 2008

The simplest way to do that is to create a section called "events" with fields for: date, name, location, and description and then display the events sorted by date.

To sort by date with the newest events first go into the "Section Editors" menu and set "List Order" to "date DESC". That's some simple MySql and it means sort by date in descending order.

I hope that helps, let me know if you need more details and I'll be happy to provide it.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] adding a calendar?

By Djulia - January 30, 2008

Hi,

I would like to use a calendar to highlight my recordings.

The class that I use, give the possibility of creating the calendar with a table (array) directly in myPage.php.
This class is very complete (I thank the author !).
http://style-vs-substance.com/calendarclassphp/

Here an example of use in myPage.php :

<?php
require_once('calendar.class.php');
$calendar = new Calendar();

$calendar->highlighted_dates = array(
'2008-01-05',
'2008-01-08',
'2008-01-09',
'2008-01-11',
'2008-01-14',
);
print($calendar->output_calendar());
?>

My problem is that I cannot obtain a table dynamically.

'2008-01-05',
'2008-01-08',
'2008-01-09',
'2008-01-11',
'2008-01-14'

I tested this code, but that does not function (I obtain only Array):

<?php
require_once('calendar.class.php');
$calendar = new Calendar();
foreach ($listRows as $menuRecord){
$table[] = $menuRecord['Add_Date'];
}
print($calendar->highlighted_dates = $table);
?>


Does somebody have an idea ?

Thank you for your answers.

Djulia

Re: [Djulia] adding a calendar?

By Dave - January 31, 2008

I've never used that class. But here's a guess.

Instead of this:

print($calendar->highlighted_dates = $table);

Try this:

$calendar->highlighted_dates = $table;
print($calendar->output_calendar());


Also, you can use this code to see what's in $table and make sure it has the right values:

print "<xmp>";
print_r($table);
print "</xmp>";


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

Re: [Dave] adding a calendar?

By Djulia - January 31, 2008 - edited: January 31, 2008

If somebody wishes to use this class :


<?php
require_once('calendar.class.php');
$calendar = new Calendar();
setlocale(LC_ALL, 'es_ES.UTF8');
$calendar->link_to = 'search.php';

foreach ($listRows as $menuRecord){
$date = date("Y-m-d", strtotime($menuRecord['mod_date']));
$table[] = $date;
}

$calendar->highlighted_dates = $table;
print($calendar->output_calendar());

?>

Thank you for your assistance Dave, you directed me towards the good direction. [:)]

Djulia
Attachments:

calendar.gif 9K

Re: [Djulia] adding a calendar?

By Dave - January 31, 2008

Looks good! Nice work. :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] adding a calendar?

By Djulia - January 31, 2008

Yes, it is easy thus to highlight dates with your CMS and this class. [:)]

In a forthcoming update, it will be possible to obtain the automatic update of the date ?

http://www.interactivetools.com/forum/forum.cgi?post=58761

Thank,

Djulia
Attachments:

sample.gif 24K

Re: [Djulia] adding a calendar?

By Dave - February 1, 2008

It's scheduled for the next release (v1.10), let me know if you want some code to make it work now (you may have to change or make the edit again with the new release though).

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

Re: [Djulia] adding a calendar?

By Djulia - August 31, 2009 - edited: August 31, 2009

Hi,

This post is old, but I wish to supplement it with another script that Jon propose on its site.
http://www.fromthedesk.com/script.php?sid=11

It is very simple to use it, just with a file XML. We made tests with cmsBuilder and we did not encounter a problem.

Jon made a recent update to obtain a presentation with 12 months.
http://www.fromthedesk.com/code/xmlCalendar2/12month.php

I think that this script will be very utilile for the users of cmsBuilder !

Djulia