Mr Chris Posted May 18, 2007 Share Posted May 18, 2007 Hi All, I’ve been working on this events calendar that I found on t’internet for a while now and think I have got it working to suit my needs apart from one thing which is driving me crazy. If you could kindly take a look at: http://www.slougheaz.org/calendar/calendar.php And click on one of the Blue days. Now as you can see this launches a pop-up with an event that STARTS on that day, but DOES NOT finish on that day. So what I want is to make each day the event is on a link. Could anyone please help me on how I can do this? I have a start_date and an end_date, so how do I make the start_date, the dates between and the end_date a link Thanks Chris <? // New Query Want to get the between dates? $sql = "SELECT DATE_FORMAT(start_date,'%Y%m%d') AS start,DATE_FORMAT(end_date,'%Y%m%d') AS end FROM cms_events"; $qry = mysql_query($sql) or die("SQL Error: $sql<br" . mysql_error()); $arrEVENTS = array(); WHILE ($r = mysql_fetch_array($qry)) : $arrEVENTS[$r['start_date']] = 1; ENDWHILE; $pMON = (isset($_GET['m']) ? $_GET['m'] : gmdate("Ym")); $thisMONyy = substr($pMON,0,4); $thisMONmm = substr($pMON,4,2); $BOM = gmmktime(0,0,0,$thisMONmm,1,$thisMONyy); $EOM = gmmktime(0,0,0,$thisMONmm+1,0,$thisMONyy); $BOC = gmmktime(0,0,0,$thisMONmm,1-gmdate("w", $BOM),$thisMONyy); $EOC = gmmktime(0,0,0,$thisMONmm+1,0+(6-gmdate("w",$EOM)),$thisMONyy); $PREVmon = gmdate("Ym",gmmktime(0,0,0,$thisMONmm-1,1,$thisMONyy)); $NEXTmon = gmdate("Ym",gmmktime(0,0,0,$thisMONmm+1,1,$thisMONyy)); $PREVyear = gmdate("Ym",gmmktime(0,0,0,$thisMONmm,1,$thisMONyy-1)); $NEXTyear = gmdate("Ym",gmmktime(0,0,0,$thisMONmm,1,$thisMONyy+1)); print "<table style='smCal' cellspacing=0 cellpadding=0 bgcolor=c0c0c0>"; print "<tr bgcolor=navy>"; print "<td class='month' width='100%' colspan='7'>"; print "<table width='100%'><tr>"; print "<td align='left'>"; print "<a href='{$_SERVER['PHP_SELF']}?m=$PREVyear'>«</a> "; print "<a href='{$_SERVER['PHP_SELF']}?m=$PREVmon'><</a>"; print "</td>"; print "<td class='month'>" . gmdate("F Y", $BOM) . "</td>"; print "<td align='right'>"; print "<a href='{$_SERVER['PHP_SELF']}?m=$NEXTmon'>></a>"; print "<a href='{$_SERVER['PHP_SELF']}?m=$NEXTyear'>»</a>"; print "</td>"; print "</tr></table>"; print "</td>"; print "<tr>"; print "<tr class='header'>"; $DOWheader = array("Su","Mo","Tu","We","Th","Fr","Sa"); foreach($DOWheader as $dow => $thisHEADER) : print "<td align='right'><b>$thisHEADER</b></td>"; endforeach; print "</tr>\n"; $rows = 0; $x = $BOC; DO { $dow = gmdate("w", $x); if ($dow == 0) : print "<tr>\n"; endif; $thisSTYLE = ""; IF (isset($arrEVENTS[gmdate("Y-m-d",$x)])) : $thisSTYLE = "style='color:DarkGreen;'"; ENDIF; print "<td class='" . (gmdate("Ym",$x) == $pMON ? "active" : "inactive") . "'>"; IF (isset($arrEVENTS[gmdate("Y-m-d",$x)])) : // OLD CODE TO PRINT JUST START DATE // print "<a href=\"javascript:void(null);\" onclick=\"pop_up('details.php?start_date=" . gmdate("Y-m-d", $x) . "');\">"; print "<a href='youlink.html'>".date ("d F Y",strtotime("Y-m-d"))."</a>"; ENDIF; print gmdate("j",$x); IF (isset($arrEVENTS[gmdate("Y-m-d",$x)])) : print "</a>"; ENDIF; print "</td>\n"; if ($dow == 6) : print "</tr>\n"; $rows++; endif; $x+=86400; } WHILE ($x <= $EOC and $rows <= 5); print "<table>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/51972-calendar-help/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.