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)ssi_max_days.html only displays events for the month
Pages: [1]   Go Down
Print
Author Topic: ssi_max_days.html only displays events for the month  (Read 436 times)
0 Members and 1 Guest are viewing this topic.
Kristen
Guest
« on: July 27, 2005, 12:46:00 PM »

I am using ssi_max_days.html to display events for the next 30 days on my web page, but one of the limitations of the script is that it will only show events for that month, no matter what you set the variable $max_days to.  Is there anyway to tweak it so that it will show events in the next month to?

Here is ssi_max_days.html

<%
$DAY = $Grid->{'grid'}->

  • ->
  • ;
    $EVENTS = $DAY->{events};
    $total_events=0;
    $max_days=30;
    $total_days=0;
       $time = time;
       ($neg_pos,$hours) = ($vars{time_offset} =~ /([+-])(\d+)/);
       if ($neg_pos eq '+') {
          $time += (60*60 * $hours);
       }
       else {
       $time -= (60*60 * $hours);
       }
       ($mday,$month,$year) = (localtime($time))[3,4,5];
       $month = $month+1;
       $year = $year+1900;
       $datestamp = sprintf("%4.4d%2.2d%2.2d",$year,$month,$mday);
    %>
    <DIV STYLE="margin-left:10; margin-right:5;margin-top:0;">
    <DL>
    <FONT size=1>
    <a HREF="<%=$AdminConfig->get("calendar_url")%>?calendar=<%=$Calendar%>" target=_blank>View Calendar</a><br><br>
    <STRONG>Upcoming Events:</STRONG></FONT><br><br>
    <%FOREACH EVENTLIST%>
       <%IF EVENTS EXIST%>
       <%$total_events++;%>
       <%if($DAY->{dd} >= $mday) { %>
       <%if($total_days >= $max_days) {
            exit();
       }%>
       <%$total_days++;%>

       <DT>
          <a href="<%= $CGI_URL %>?view=Day&datestring=<%=$YEAR%><%=$MONTH%><%=$linkday%>" target=_blank><font size=1 COLOR="#000000"><%=$DAY->{monthname}%> <%=$DAY->{'dd'}%></font></a>
          <BR>
    <ul STYLE="margin:0; padding:0; margin-left:15px;list-style-type: disc; ">
          <%FOREACH EVENT%>
             <font size=1><li>
             <%= $EVENT->{'details'}->{'title'} %></li></font>         
             <BR>
          <%/FOREACH%>
    </ul>
          <BR>
       <%/IF%>
       <%}%>
    <%/FOREACH%>
    </DL>
    <%unless($total_events){%>
    <CENTER><I>No Events</I></CENTER>
    <% } %>
    </DIV>

    Thanks!!!
    Kristen

Logged
Kristen
Guest
« Reply #1 on: August 03, 2005, 11:52:00 AM »

Hi there,
I really would like to figure this out.  Anyone out there know how to display events in more than one month, so that if I set the duration to 30 days and it is near the end of the month, events in the next month will be displayed?

Thanks!
Kristen

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #2 on: August 03, 2005, 12:46:00 PM »

** Anyone out there know how to display events in more than one month **

I don't know how you can correct the above template but the original ssi.html template that is supplied with CalendarScript can display events for durations spanning months.

JFYI

Dan O.

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

Logged
Kristen
Guest
« Reply #3 on: August 17, 2005, 01:28:00 PM »

I still can't get more than one month to show up.
I used the ssi.html file and that would only display one month too.  I really need to figure this out.  If anyone out there can help, it would be greatly appreciated!

You can see the results of the code I am using now at http://www.kristenwalker.com/test.php

Here is the code I am using now:

<%
&getEvents( {'duration'=>$in{duration}} );
$DAY = $Grid->{'grid'}->

  • ->
  • ;
    $EVENTS = $DAY->{events};
    $total_events=0;
    $time = time;
       ($neg_pos,$hours) = ($vars{time_offset} =~ /([+-])(\d+)/);
       if ($neg_pos eq '+') {
          $time += (60*60 * $hours);
       }
       else {
       $time -= (60*60 * $hours);
       }
       ($mday,$month,$year) = (localtime($time))[3,4,5];
       $month = $month+2;
       $year = $year+1900;
       $datestamp = sprintf("%4.4d%2.2d%2.2d",$year,$month,$mday);

    %>
    <DL>
    <%if($MONTH <= 9) {
          $MONTH = "0$MONTH";
    }%>
    <%FOREACH EVENTLIST%>
       <%IF EVENTS EXIST%>
       <%$total_events++;%>
       <%if($DAY->{dd} >= $mday) { %>
       <DT>   <a href="<%= $CGI_URL %>?calendar=&selected_datestring=<%=$YEAR%><%=$MONTH%><%=$DAY->{'dd'}%>&datestring=<%=$YEAR%><%=$MONTH%><%=$DAY->{'dd'}%>&template=day. html&duration=60d" target=_blank><font size=1 COLOR="#000000"><%=$DAY->{monthname}%> <%=$DAY->{'dd'}%></font></a>
       <BR>      
       <DD>
       <ul STYLE="margin:0; padding:0; margin-left:5px;list-style-type: disc; ">
          <%FOREACH EVENT%>
             <font size=1><li>
             <%= $EVENT->{'details'}->{'title'} %></li></font>         
             <BR>
          <%/FOREACH%>
    </ul><br>
       <%/IF%>
         <%}%>
    <%/FOREACH%>
    </DL>
    <%unless($total_events){%>
    <CENTER><I>No Events</I></CENTER>
    <% } %>
    <A HREF="<%=$AdminConfig->get("calendar_url")%>?calendar=<%=$calendar_key%>">View Calendar</A>

Logged
Kristen
Guest
« Reply #4 on: August 17, 2005, 04:25:00 PM »

Okay, I figured out how to display events in the next month, but now the links to the days are wrong.  They are okay for the first month, but the month number does not change for the second month, so when you click on links for those days, you get taken to the day of first month.

This is the code I am using to link to the calendar day:

<a href="<%= $CGI_URL %>?calendar=&selected_datestring=<%=$YEAR%><%=$MONTH%><%=$DAY->{'dd'}%>&template=day.html" target=_blank><font size=1 COLOR="#000000"><%=$DAY->{monthname}%> <%=$DAY->{'dd'}%></font></a>

The monthname shows up correctly, but the value of <%=$MONTH%> is not changing accordingly.

Does anyone know what's going on?

Thanks!
Krisen

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #5 on: August 17, 2005, 05:15:00 PM »

** I used the ssi.html file and that would only display one month too. **

Really?? As long as you were passing the correct duration information to the template, there should be no reason it wouldn't display more than the current month's events. AFAIK. There should be no limit to the number of days it is capable of displaying. It only defaults to the current month if no duration information is received by it.

I'm afraid I have no idea where you problem is.

Dan O.

[This message has been edited by DanO (edited August 17, 2005).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #6 on: August 17, 2005, 05:22:00 PM »

** The monthname shows up correctly, but the value of <%=$MONTH%> is not changing accordingly **

From the Documentation: Customization: Defined Variables:

quote:
$MONTH The month number of the currently displayed date.
Which usually means the name of the first month being displayed on the template.

JFYI

Dan O.

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

Logged
Kristen
Guest
« Reply #7 on: August 19, 2005, 06:50:00 PM »

Is there any way to get the month to change?
Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #8 on: August 19, 2005, 08:23:00 PM »

** Is there any way to get the month to change? **

Yes, use the correct variable. Check the docs at the page I previously linked to about the $Grid variable.

But, if you're just trying to generate a datestring for use in the link URL, the following variable should generate the whole datestring, no need for separate <%=$YEAR%> <%=$MONTH%> <%=$DAY->{'dd'}%> variables at all.

$DAY->{'datestring'}

BTW. Using the month variable alone wouldn't necessarily generate a 2-digit (01, 02, 03, etc.) value like the datestring would need. I believe it only returns a single digit date (1, 2, 3, etc.) but if you want to try:

$DAY->{'mm'}

JFYI

Dan O.

[This message has been edited by DanO (edited August 19, 2005).]

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