Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Calendar Script CommunityCustomizationCustomizing CalendarScript (Moderators: scott, DanO, Marty)adding event list to month view with next 3 months
Pages: [1]   Go Down
Print
Author Topic: adding event list to month view with next 3 months  (Read 349 times)
0 Members and 1 Guest are viewing this topic.
Alvy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: July 21, 2003, 10:49:00 PM »

I am able to display events for the next three month starting next month with this code:

<!--#include file="preferences.pl"-->
<%
$startTime = Time::Local::timegm(0, 0, 0, 1, $MONTH, $YEAR-1900);
$endTime = Time::Local::timegm(0, 0, 0, 1, $MONTH+3, $YEAR-1900) - 1;
if ($MONTH+3 > 11) { $endTime = Time::Local::timegm(0, 0, 0, 1, $MONTH-8, $YEAR-1899) - 1; }
&getEvents( {'start'=>$startTime, 'end'=>$endTime});
%>
<DL>
<%FOREACH EVENTLIST%>
   <%IF EVENTS EXIST%>
   <%$total_events++;%>
   <DT><%=$DAY->{dayname}%>, <%=$DAY->{monthname}%> <%=$DAY->{dd}%>
   <DD>
      <%FOREACH EVENT%>blaablaablaa

But only when I call it in SSI.

I pasted this code after the footer in default.html
and I get events for this month as well as the next 3 months. I only want the next three month because I have THIS month view above it already.

The code is exactly the same... and I am getting this month's events, plus the next three months, and NOT getting the fourth month, SO it seems to mostly work..

any advise?Huh?

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: July 22, 2003, 01:16:00 PM »

** I get events for this month as well as the next 3 months. I only want the next three month **

Well since $MONTH is a variable containing a reference to this month (the one being displayed), you could try $MONTH+1 in the following line of code:

$startTime = Time::Local::timegm(0, 0, 0, 1, $MONTH, $YEAR-1900);

This code is untested so use at your own risk and always keep a backup or original files.

Dan O.

 BTW. You may have problems with that code towards the end on the year as in December $MONTH will be 12 and adding 1 to it would ask the script for data starting month 13 which there is none.


------------------

[This message has been edited by DanO (edited July 22, 2003).]

Logged
Alvy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #2 on: July 22, 2003, 03:59:00 PM »

The code does work as a ssi.html when called in include file, like for a home page.
It is july now.. and It shows only events for aug, sept oct.
But the exact same code pulls in this month plus the next three months when i use it in Default.html in the templates.

Why does it work as a SSI and not as part of the default.

>>Well since $MONTH is a variable containing a reference to this month (the one being displayed), you could try $MONTH+1 in the following line of code:

I don't know why it works without the +1, but it does. when I add the +1 in the SSI file, it only pull from sept & oct, but not aug.
And in the default.html file, it still pulls all four months.

>>BTW. You may have problems with that code towards the end on the year as in December $MONTH will be 12 and adding 1 to it would ask the script for data starting month 13 which there is none.

I was hoping that this line would accomidate that ...
if ($MONTH+3 > 11) { $endTime = Time::Local::timegm(0, 0, 0, 1, $MONTH-8, $YEAR-1899) - 1; }

since the months are 0 thru 11, correct??


I was trying to modify the code I found here designed to show this month and next months events. http://www.calendarscript.com/support/forum/Forum4/HTML/000217.html

code:
<%
$startTime = Time::Local::timegm(0, 0, 0, 1, $MONTH-1, $YEAR-1900);
$endTime = Time::Local::timegm(0, 0, 0, 1, $MONTH+1, $YEAR-1900) - 1;
if ($MONTH+1 > 11) { $endTime = Time::Local::timegm(0, 0, 0, 1, $MONTH-11, $YEAR-1899) - 1; }
&getEvents( {'start'=>$startTime, 'end'=>$endTime});
%>


------------------

[This message has been edited by Alvy (edited July 22, 2003).]

Logged
Alvy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #3 on: July 24, 2003, 12:01:00 AM »

For every fix or workaround to accomplish my goal, two new problems arise.

SO I am now trying to think outside the box....

What I want: To display One month calendar with a list of the next two (or three) months events in list form under the one month calendar.

Problems: I believe that the script get confused if I use two renditions of the script on the same page.

Proposal: What if I take the 90 day calendar (which should work as-is) and tell the grid to stop after one month and switch to  list view for the next two month.

Question: I have no idea how to do this. I looked at the format for the ninety day calendar and it basically just adds the month name to every occurrance of the date=1.

So I am thinking that i could tell the loop "on the second occurrance of date=1, start using LIST format"

Does any one think i am crazy? Does anyone have any ideas how to help me get this going?

Thanks for your time...

alvy

------------------

Logged
Alvy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #4 on: July 28, 2003, 11:08:00 AM »

Just to close out this thread.. here is how I solved my problem.
I wanted basically to run the same calendar twice on the same page, using different parameters for each, (a one month grid view, and a three month list view).

It was kinda simple... I just made a blank page with two includes. One calls the month view, the other call the list view. SO simple.

I got so stuck on trying to call the list view from with the month view but that never worked out.

Thanks every one for the help.

------------------

Logged
Pages: [1]   Go Up
Print
Jump to: