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>
Web Servers

Avatar of undefined
Last Comment
jabronicus

8/22/2022 - Mon
gdemaria

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>

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
gdemaria

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
jabronicus

ASKER
Brilliant
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes