benji87 Posted August 21, 2007 Share Posted August 21, 2007 Hi all. I managed to download a good php calendar for my new site. It works great but only problem is when i go to embed it in a page using php include, it displays fine but when you hover over a event date it is supposed to come up with a little box telling you what it is. Instead it just shows nothing but extends the page (as in the scrollbar gets longer) i cant work this out. I know it uses javascript for the little popup and all the links are pointing in the right direction just seems very strange. If someone could take a look that would be great. here is my calendar script: <?php include('cp/config.php'); ?> <style type="text/css" media="all">@import "style.css";</style> <script language="JavaScript" type="text/javascript"> window.defaultStatus="Calendar Script"; </script> <script type="text/JavaScript"> function popupEvent(day, month, year, w, h) { var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; win = window.open("popup.php?day=" + day + "&month=" + month + "&year=" + year + "","Calendar","scrollbars=yes, status=yes, location=no, toolbar=no, menubar=no, directories=no, resizable=yes, width=" + w + ", height=" + h + ", top=" + wint + ", left=" + winl + ""); if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } } </script> </head> <body> <script type="text/JavaScript"> var ol_width=140; var ol_delay=10; var ol_fgcolor="#FFFFFF"; var ol_bgcolor="#AAAAAA"; var ol_offsetx=10; var ol_offsety=10; var ol_border=1; var ol_vauto=1; </script> <div id="overDiv" style="position: absolute; visibility: hidden; z-index: 1000;"></div> <div align="left"> <script type="text/JavaScript" src="overlib_mini.js"><!-- overLIB (c) Erik Bosrup --></script> <?php // Free Calendar Script // Coded and Designed by Bahadir Kocaoglu ([email protected]) // (C) 2007 Eggdrop Inc. // http://www.eggdrop.gen.tr // [email protected] if (empty($_GET['month'])) { $month = date('m'); } else { $month = $_GET['month']; } if (empty($_GET['year'])) { $year = date('Y'); } else { $year = $_GET['year']; } $theday = date('w', mktime(0, 0, 0, $month, 1, $year)); $daysinmonth = date("t", mktime(0, 0, 0, $month, 1, $year)); ?> <table border="0" align="left" cellpadding="0" cellspacing="1" class="mainTable"> <tr> <td align="center" colspan="7" class="monthRow"> <a href="<?php echo $_SERVER['PHP_SELF']; if ($month == '01') { $prevmonth = '12'; $prevyear = $year - 1; echo '?month=' . $prevmonth; echo '&year=' . $prevyear; } else { $prevmonth = $month - 1; echo '?month=' . $prevmonth; echo '&year=' . $year; } ?>">«</a> <?php $monthName = date('F', mktime(0, 0, 0, $month, 1, $year)); $yearName = date('Y', mktime(0, 0, 0, $month, 1, $year)); echo $monthName . ' ' . $yearName; ?> <a href="<?php echo $_SERVER['PHP_SELF']; if ($month == '12') { $nextmonth = '01'; $nextyear = $year + 1; echo '?month=' . $nextmonth; echo '&year=' . $nextyear; } else { $nextmonth = $month + 1; echo '?month=' . $nextmonth; echo '&year=' . $year; } ?>">»</a> </td> </tr> <tr class="dayNamesText"> <td class="dayNamesRow" width="25" align="center">S</td> <td class="dayNamesRow" width="25" align="center">M</td> <td class="dayNamesRow" width="25" align="center">T</td> <td class="dayNamesRow" width="25" align="center">W</td> <td class="dayNamesRow" width="25" align="center">T</td> <td class="dayNamesRow" width="25" align="center">F</td> <td class="dayNamesRow" width="25" align="center">S</td> </tr> <tr class="rows"> <?php for ($i = 0; $i < $theday; $i++) { ?> <td> </td> <?php } for ($list_day = 1; $list_day <= $daysinmonth; $list_day++) { $tm = date("U", mktime(0, 0, 0, $month, $list_day, $year)) - 86400; // Bir gün önce $tn = date("U", mktime(0, 0, 0, $month, $list_day, $year)); // O gün ... $tp = date("U", mktime(0, 0, 0, $month, $list_day, $year)) + 86400; // Bir gün sonra $Q = sprintf("SELECT * FROM `events` WHERE `date` > '%s' AND `date` < '%s' AND `day` = '%s';", $tm, $tp, $list_day); $R = mysql_query($Q); $D = mysql_fetch_assoc($R); $S = mysql_num_rows($R); $Y = $D['date']; $TheDay = date('d', $Y); $TheMon = date('F', $Y); $TheYea = date('Y', $Y); mysql_free_result($R); if ($S) { ?> <td align="center" onclick="popupEvent(<?php echo $D['day']; ?>, <?php echo $D['month']; ?>, <?php echo $D['year']; ?>, 400, 500)" style="background-color: #A200FF; color: #333333; cursor: pointer;" onmouseover="return overlib('<table width="100%" border="0" cellpadding="2" cellspacing="0" class="popupDateTable"><tr><td align="center" class="popupDate"><?php echo $TheDay; ?> <?php echo $TheMon; ?> <?php echo $TheYea; ?></td></tr></table><div class="popupEventTitle s23"><?php echo $S; ?> Record(s)</div>');" onmouseout="return nd();" title=""> <?php } elseif ($tn > $tm AND $tn < $tp AND date('j') == $list_day AND date('m') == $month AND date('Y') == $year) { ?> <td align="center" style="background-color: #FFC18A; color: #CF0000; cursor: pointer;" onmouseover="return overlib('<div style="background-color: #FFC18A; color: #CF0000; padding: 4px;">Today</div>');" onmouseout="return nd();"> <?php } elseif ($theday == 6 or $theday == 0) { ?> <td align="center" style="background-color: #EEEEEE; color: #666666;"> <?php } else { ?> <td align="center" style="background-color: #CCCCCC; color: #333333;"> <?php } echo $list_day; echo '</td>'; if ($theday == 6) { echo '</tr>'; echo '<tr class="rows">'; $theday = -1; } $theday++; } ?> </tr> </table> </div> </body> </html> You can view the calendar working at: www.alns.co.uk/newsite/calendar/ Or you can view the embedded version at: www.alns.co.uk/newsite/news.php cheers Link to comment https://forums.phpfreaks.com/topic/65956-calendar-script-include-problems/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.