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: [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

Thank you Dave, that works. [:)]

But, now I must obtain the good format of date.

The table give :

Array
(
[0] => 2008-01-31 00:00:01
[1] => 2008-01-27 00:00:00
)


But the class works only with the format '2008-01-31'

Array
(
'2008-01-31'
'2008-01-27'
)

I have for mod_date :

Field Label: Mod_Date
Standard Field: date/time
Specify Time == null
Use 24 Hour Time == null
Specify Seconds == null


I think that the solution is to convert the date, but I do not see how to obtain my table thus.

date("Y-m-d", strtotime($pageRecord['mod_date']))
$table[] = $menuRecord['mod_date'];

An idea ?

Thank you for your assistance.

Djulia

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