PDA

View Full Version : Displaying Months as Table Heading in List View


cgrodriguez
09-14-2009, 05:09 PM
Hi

I am a newbie so I apologize if this has been done before but I need to be able to display the calendar in full year view in list mode.

What I need is to be able to display the month and year as the heading of the table for each month displayed. It should look like this:

September 2009
-----------------------------------------------------
16 Sep Mon - Event 1
22 Sep Mon - Event 2

October 2009
-----------------------------------------------------
19 Oct Mon - Event 3
24 Oct Mon - Event 4

I was able to change the calendar to full year and also format the date/event this way. I am not sure how to implement the month headings before starting each month.

Was wondering if I can do this with one calendar or do I implement this as multiple calendars (one per month)?

Many thanks

Christine

Brian
09-14-2009, 05:25 PM
Can you write a little PHP code?

You should be able to run a for/next loop for the 12 months and create your own headers while setting the calendar $mo variable to match the month and setting the options to list all events for the month.

cgrodriguez
09-14-2009, 08:33 PM
Thanks for the quick response. I believe this should work for me.
-Christine

dave_gordon
10-07-2009, 01:55 AM
Hi Christine,
This is exactly what I'm looking for. If developed, is there any chance you could share the code?
Many thanks
Dave

cgrodriguez
10-07-2009, 10:27 AM
Hi Dave

Here's the code. Let me know if you have problems. Make sure to replace the template name and use the correct path for your calendar.

<?php

// print each months string name (i.e. January 2009)
$year = "2009";
for ($mo=1; $mo<=12; $mo++) {
// print month headers
$monthStr = date("F Y", mktime(0, 0, 0, $mo, 1, $year));
echo $monthStr."<br>";

// print each months events
$epcListMouseover=1; // use pop ups
$LIST=1;
$DF = "d M D";
$template="mytemplate.php";
require("../calendar/calendar.php");
}

?>

-Christine

dave_gordon
10-07-2009, 10:45 AM
Thanks Christine, you're a star:thumbs_up