Link to home
Start Free TrialLog in
Avatar of jabronicus
jabronicus

asked on

Calendar Help

For this particular calendar usually there is one event per day and never more than two events per day.  This is a preview calendar on my home page that gives tooltips when scrolled over.  I don't want to make it any bigger than it already is.  When I have more than one event per day the day is shown twice which of course causes some layout issues.

Do you know of any creative ideas that I can get around this one.  


<cfoutput>
  <!---Calendar Days Begin--->
      <tr>
        <cfloop from="1" to="7" index="i">
          <td><cfif nCounter GTE nFirstDayOfMonth AND nDayOfMonth LTE nDaysInMonth>
              <table cellspacing="0">
                <tr>
                  <td align="center"  class="date"><cfset hit = 0>
                    <cfloop query="concerts">
                      <cfif Day(concerts.DateTime) EQ nDayOfMonth>
<a class="DateofEvent" href="EventDetails.cfm?concertid=#concerts.ConcertID#&amp;programid=#concerts.ProgramID#" onMouseover="showtip(this,event,'#concerts.Title#, #LSTimeFormat(concerts.DateTime)#')" onMouseout="hidetip()">#nDayofMonth#</a>                      
<cfset hit = 1>
                      </cfif>
                    </cfloop>
                    <cfif hit eq 0>
                      #nDayofMonth#
                    </cfif>
                  </td>
                </tr>
              </table>
              <cfset nDayOfMonth = nDayOfMonth + 1>
            </cfif>
            <cfset nCounter = nCounter + 1 />
        </cfloop>
      </tr>
            </cfloop>
      <!---Calendar Days End--->
   
  </table>
</cfoutput>
Avatar of gdemaria
gdemaria
Flag of United States of America image

The first thing you have to do is decide what happens when someone clicks on the date.  If you have one event, it's easy to link to that event, if you have two events, you will have to decide what to do.   In this case, I am passing both IDs to eventDetails.cfm assuming that it can handle a list of IDs such as  101, 203    EventDetails.cfm should show both those events.

In this example, I loop for the events building the list of IDs and a list of Tips.
Once the loop is done, show the tips and link the IDs, if no events, just show the date.

                  <td align="center"  class="date"><cfset hit = 0>
                    <cfset variables.IDs = "">
                    <cfset variables.Tips = "">
                    <cfloop query="concerts">
                      <cfif Day(concerts.DateTime) EQ nDayOfMonth>
                          <cfset variables.IDs = listAppend(variables.IDs, concernts.concertID)>
                          <cfset variables.Tips = listAppend(variables.Tips, "#concerts.Title# #LSTimeFormat(concerts.DateTime)#">
                       </cflif>
                     </cfloop>
                     
             <cfif listLen(variables.IDs)>
<a class="DateofEvent" href="EventDetails.cfm?concertid=#variables.IDs#;programid=#concerts.ProgramID#" onMouseover="showtip(this,event,'#variables.Tips#')" onMouseout="hidetip()">#nDayofMonth#</a>
             <cfelse>
                #nDayofMonth#
             </cfif>

Avatar of jabronicus
jabronicus

ASKER

Sorry it took me so long to get back.  

The main issue is that when a date has two events it is usually the same event at different times.  On this particular calendar I have no need to display both events, just one will be fine.  When they click on that date it will present them with both events.

I need to just display one event per date otherwise this small table loses its format.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Brilliant