PDA

View Full Version : FireFox OMG!



kuau
05-18-2008, 04:30 AM
I inherited this code from someone else and it is full of tables (yuk!). I have css'd as much as I could without breaking it. I definitely broke the mini calendar so had to put it back the way it was. It looks fine in IE7 but I just saw it in FF and it looks ghastly! The guy used blank.gif's all over the place... I never did understand what they did, so I am not sure what is causing these thick black lines. Can someone please look at this page first in IE7 and then in FF and tell me what in god's name is going on? I thought I was done and now this...

http://www.calendarmaui.com/

Also, why did the Google Ads disappear? Good grief. Thanks, erin

techno_race
05-18-2008, 05:03 AM
WTF? We need to see the original version as well.

kuau
05-18-2008, 05:17 AM
OK, here is the original page: http://www.calendarmaui.com/index-sav.php

But that section of code in my page is the original code. Anyway, here it is with the php and all...


<p><i>Choose a day from below</i></p>
<?
if ( empty ( $friendly ) ) { ?>

<table border="0" cellpadding="0" cellspacing="0">
<tr><td><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000" colspan="15"><img src="img/gr/blank.gif" width="1" height="1"></td></td></tr>
<tr><td><img src="img/gr/blank.gif" width="1" height="36"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td align="center" bgcolor="#EEEEEE"><h2><a href=index.php?date=<? echo"$month_ago"; ?>><img src=/img/gr/last.gif width=29 height=30 border=0></a></h2></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td colspan="9" align="center" bgcolor="#FFFFCC"><h2><?php echo month_name ( $thismonth - 1 ) . " $thisyear"?></h2></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td align="center" bgcolor="#EEEEEE"><h2><a href=index.php?date=<? echo"$month_ahead"; ?>><img src=/img/gr/next.gif width=29 height=30 border=0></a></h2></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#FFFFFF" align=left><img src="img/gr/topright.gif" width="7" height="36"></td>
</tr>
<tr>
<td><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#FFFFFF" background="img/gr/right.gif"><img src="img/gr/blank.gif" width="1" height="1"></td>
</tr>
<tr>
<td><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Sun</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Mon</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Tue</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Wed</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Thu</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Fri</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Sat</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#FFFFFF" background="img/gr/right.gif"><img src="img/gr/blank.gif" width="1" height="1"></td>
</tr>
<tr>
<td><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>

<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#FFFFFF" background="img/gr/right.gif"><img src="img/gr/blank.gif" width="1" height="1"></td>
</tr>

<?php // generate values for first day and last day of month
$monthstart = mktime ( 2, 0, 0, $thismonth, 1, $thisyear );
$monthend = mktime ( 2, 0, 0, $thismonth + 1, 0, $thisyear );
if ( $WEEK_START == "1" )
$wkstart = get_monday_before ( $thisyear, $thismonth, 1 );
else
$wkstart = get_sunday_before ( $thisyear, $thismonth, 1 );
$wkend = $wkstart + ( 3600 * 24 * 7 );

for ( $i = $wkstart; date ( "Ymd", $i ) <= date ( "Ymd", $monthend );
$i += ( 24 * 3600 * 7 ) ) {
for ( $i = $wkstart; date ( "Ymd", $i ) <= date ( "Ymd", $monthend );
$i += ( 24 * 3600 * 7 ) ) {
if ($i != $wkstart ){
?>
<tr>
<td><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000" colspan="15"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor=#FFFFFF background=/img/gr/right.gif><img src=/img/gr/blank.gif width=1 height=1></td>
</tr>
<?
}
echo "<tr><td><img src=/img/gr/blank.gif width=1 height=30></td>\n";
for ( $j = 0; $j < 7; $j++ ) {
$date = $i + ( $j * 24 * 3600 );
if ( date ( "Ymd", $date ) >= date ( "Ymd", $monthstart ) &&
date ( "Ymd", $date ) <= date ( "Ymd", $monthend ) ) {
if ( date ( "Ymd", $date ) == date ( "Ymd" ) )
echo "<td bgcolor=000000 width=1><img src=/img/gr/blank.gif width=1 height=30></td><TD width=33 BGCOLOR=\"FFFFCC\" ALIGN=CENTER>";
else
echo "<td bgcolor=000000 width=1><img src=/img/gr/blank.gif width=1 height=30></td><TD width=33 ALIGN=CENTER>";
echo "<A HREF=/day.php?date=" . date ( "Ymd", $date ) . "&top=0&page=0&query_save=SELECT+%2A+FROM+webcal_entry%2Cwebcal_entry_user+WHERE+webcal_entry.cal_date+%3E%3D" . date ( "Ymd", $date ) . "+AND+webcal_entry.cal_date%3C%3D" . date ( "Ymd", $date ) . "+AND+webcal_entry_user.cal_id%3Dwebcal_entry.cal_id+AND+webcal_entry_user.cal_login%3D%27whatdayisit%27+AND+webcal_entry_user.cal_status%3D%27A%27++ORDER+BY+cal _date >" .
date ( "d", $date ) .
"</A></TD>\n";
} else {
echo "<td width=1 bgcolor=000000><img src=/img/gr/blank.gif width=1 height=30></td><TD width=33>&nbsp;</TD>\n";
}
}
echo "<td bgcolor=000000><img src=/img/gr/blank.gif width=1 height=30></td><td bgcolor=#FFFFFF background=/img/gr/right.gif><img src=/img/gr/blank.gif width=1 height=1></td></TR>\n";
}
}
?>

<tr><td><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000" colspan="15"><img src="img/gr/blank.gif" width="1" height="1"></td></tr>
<tr><td colspan=3 background=/img/gr/botleft.gif><img src="img/gr/botleft2.gif" width="35" height="7"></td>
<td background=/img/gr/bot.gif colspan="10"><img src="img/gr/blank.gif" width="1" height="7"></td>
<td colspan=3 background="img/gr/bot.gif"><img src="img/gr/blank.gif" width="42" height="7"></td>
<td bgcolor=#FFFFFF background=/img/gr/botright.gif><img src=/img/gr/blank.gif width=7 height=7></td></tr>
</table>
<p><a href=/week.php>Browse <img src=/img/gr/calend.gif alt="Calendar" width=33 height=31>This Week at a Glance</a></p>
<p><a href=submit_entry.php>CLICK HERE TO SUBMIT AN EVENT</a></p>
<? } ?>

techno_race
05-18-2008, 05:20 AM
Try using that as an IFRAME.

jscheuer1
05-18-2008, 03:53 PM
That code is simply antiquated. It makes no use of the modern documentGetElementById, instead confining itself to document.all (older IE) and document.layers (older NS). It would need a complete overhaul to work in FF. There probably is a suitable replacement around though, rather than having to go to all that trouble.

The problem with Google ads appears to be a conflict with a global variable i in both Google's code and some other code on or linked to your page. But I cannot find it, unless it is a conflict with another Google script linked to that page.

Generally what you do in a case like this is to remove scripts one by one until (in this case) the ads start working again. That will at least narrow it down to which script is causing this. It could even possibly be because the same Google script is linked twice to the same page, if one is.

kuau
05-18-2008, 04:13 PM
John, thank you for coming to my rescue! I have been up all night trying to resolve this. Yes, the code is terrible & I found a replacement calendar but I can't quite knit the new calendar into the old code because I don't understand some of the code, like "date+%3E%3D" -- what the heck is %3? I can insert a hard-coded version into the page and have it actually go to the right day in the old calendar, but then I would have to update it manually as the day and month changed. I'd like to upgrade to the new calendar engine but there are 7 years of data and I'm not sure how to import it into tables that don't match the old database structure. Even if I could, I'd have to apply the site design to the generic new calendar overnight. I'm not sure which way to turn. If I could just get this calendar to look OK in FF for now it would buy me some time to do the css on the new calendar. I would really appreciate your advice in this situation. Thanks, erin

PS. The Google Ads came back as soon as I replaced the WeatherBug code!

kuau
05-18-2008, 04:24 PM
Here is the new calendar I found (hardcoded - notice it still says 17):

http://www.calendarmaui.com/minical.php

and here is the code that runs the dynamic version but references a different database structure. Does this code look good?


<?php

/* $hc_calStartDay = 1; // Calendar First Day of the Week */
?>
<form name="frmJump" id="frmJump" action="">
<table cellpadding="0" cellspacing="0" border="0" class="miniCalTable" align="center">
<?php
if(isset($_GET['day']) && is_numeric($_GET['day'])){
$curDay = $_GET['day'];
} else {
$curDay = date("d");
}//end if

if(isset($_GET['month']) && is_numeric($_GET['month'])){
$curMonth = $_GET['month'];
} else {
$curMonth = date("n");
}//end if

if(isset($_GET['year']) && is_numeric($_GET['year'])){
$curYear = $_GET['year'];
} else {
$curYear = date("Y");
}//end if

if(($curMonth < date("n") && $curYear == date("Y")) && $hc_browsePast == 0){
$curMonth = date("n");
} elseif(($curYear < date("Y")) && $hc_browsePast == 0){
$curMonth = date("n");
$curYear = date("Y");
}//end if

$query = " SELECT DISTINCT e.StartDate
FROM events e
LEFT JOIN eventcategories ec ON (e.PkID = ec.EventID)
LEFT JOIN locations as l ON (e.LocID = l.PkID)
WHERE e.IsActive = 1 AND
e.IsApproved = 1 AND
(e.StartDate BETWEEN '" . date("Y-m-d", mktime(0,0,0,$curMonth,1,$curYear)) . "' AND '" . date("Y-m-d", mktime(0,0,0,$curMonth+1,0,$curYear)) . "')";

if(isset($_SESSION['hc_favCat']) && $_SESSION['hc_favCat'] != ''){
$query = $query . " AND ec.CategoryID in (" . $_SESSION['hc_favCat'] . ") ";
}//end if

if(isset($_SESSION['hc_favCity']) && $_SESSION['hc_favCity'] != ''){
$query = $query . " AND (e.LocationCity IN (" . $_SESSION['hc_favCity'] . ") OR l.City IN (" . $_SESSION['hc_favCity'] . "))";
}//end if

$query = $query . " ORDER BY StartDate";
$result = doQuery($query);

$events[] = "";
if(hasRows($result)){
while($row = mysql_fetch_row($result)){
$events[] = stampToDate($row[0], "d");
}//end while
}//end if

$navBackMonth = ($curMonth-1) % 12;
$navBackYear = $curYear;
$navForwMonth = ($curMonth+1) % 12;
$navForwYear = $curYear;
if($curMonth == 1){
$navBackMonth = 12;
$navBackYear = $curYear - 1;
} elseif($curMonth == 11) {
$navForwMonth = 12;
} elseif($curMonth == 12){
$navForwYear = $curYear + 1;
}//end if
?> <tr>
<td class="miniCalNav" onclick="window.location.href='<?php echo CalRoot;?>/index.php?year=<?php echo $navBackYear?>&amp;month=<?php echo $navBackMonth;?>';">&lt;</td>
<td class="miniCalTitle" colspan="5">
<select name="jumpMonth" id="jumpMonth" class="miniCalJump" onchange="window.location.href=document.frmJump.jumpMonth.value;">
<?php $jumpMonth = date("n", mktime(0,0,0,$curMonth-12,1,$curYear));
$jumpYear = date("Y", mktime(0,0,0,$curMonth-12,1,$curYear));
for($i = 0; $i < 25; $i++){ ?>
<option <?php if($i == 12){echo "selected=\"selected\"";}?> value="<?php echo CalRoot;?>/index.php?year=<?php echo date("Y", mktime(0,0,0,$jumpMonth + $i,1,$jumpYear));?>&amp;month=<?php echo date("n", mktime(0,0,0,$jumpMonth + $i,1,$jumpYear));?>"><?php echo date("M Y", mktime(0,0,0,$jumpMonth + $i,1,$jumpYear));?></option>
<?php }//end for?>
</select>
</td>
<td class="miniCalNav" onclick="window.location.href='<?php echo CalRoot;?>/index.php?year=<?php echo $navForwYear?>&amp;month=<?php echo $navForwMonth;?>';">&gt;</td>
</tr>
<?php $d = $hc_calStartDay;

echo "<tr>";
$daysOfWeek = array(0 => "S", 1 => "M", 2 => "T", 3 => "W", 4 => "T", 5 => "F", 6 => "S");
for($i = 0; $i < 7; $i++){ ?>
<td class="miniCalDOW"><?php echo $daysOfWeek[$d % 7];?></td>
<?php $d++;
}//end for
echo "</tr><tr>";

$fillCnt = date("w", mktime(0,0,0,$curMonth,1,$curYear));
if($hc_calStartDay > 0){
if($hc_calStartDay <= date("w", mktime(0,0,0,$curMonth,1,$curYear))){
$fillCnt = $fillCnt - $hc_calStartDay;
} else {
$fillCnt = 7 - ($hc_calStartDay - $fillCnt);
}//end if
}//end if

for($i = 0; $i < $fillCnt; $i++){ ?>
<td class="miniCalFiller">&nbsp;</td>
<?php }//end for

for($x = 0; $x < date("t", mktime(0,0,0,$curMonth,1,$curYear)); $x++){
if($i % 7 == 0){echo "</tr><tr>";}?>
<td <?php if(($x+1 == date("d")) && (date("m") == $curMonth) && (date("Y") == $curYear)){?>class="miniCalToday"<?php }elseif(in_array($x+1, $events)){?>class="miniCalEvents"<?php }else{?>class="miniCal"<?php }?> onclick="window.location.href='<?php echo CalRoot;?>/index.php?year=<?php echo $curYear?>&amp;month=<?php echo $curMonth;?>&amp;day=<?php echo $x+1;?>';"><?php echo date("d", mktime(0,0,0,$curMonth,$x+1,$curYear));?></td>
<?php $i++;
}//end for

if($i % 7 > 0){
for($i = $i % 7; $i < 7; $i++){ ?>
<td class="miniCalFiller">&nbsp;</td>
<?php }//end for
}//end if ?>
</tr>
</table>
</form>

jscheuer1
05-18-2008, 05:50 PM
%3E%3D is one way of expressing >= the greater then or equal to operator. It may or may not be desirable to do it that way in this particular context though. When I get more time, I will go over the code, both old and new. I didn't realize that there was an old data base to consider. Converting the old code to a FF compatible version might not be all that bad, though sometimes it can be.

kuau
05-18-2008, 06:03 PM
Thanks, John! I'll hold off on shooting myself. :) erin

jscheuer1
05-18-2008, 06:09 PM
I was just looking at the code a bit more and don't really see anything that looks like an old calendar script, so my initial impression may have been wrong. This is the outdated script I saw:


ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

function init() {
if (ns4) block = document.blockDiv
if (ie4) block = blockDiv.style
block.xpos = parseInt(block.left)
block.ypos = parseInt(block.top)
block.angle = 0
block.xinc = 5*Math.cos(block.angle*Math.PI/180)
block.yinc = 5*Math.sin(block.angle*Math.PI/180)
block.count = 0
rightEdge = (ns4) ? parseInt(window.innerWidth) : parseInt(document.body.clientWidth);
bottomEdge = (ns4) ? parseInt(window.innerHeight) : parseInt(document.body.clientHeight);
moveto(block,rightEdge + 10,2);
setTimeout("go(180);",10000);
setTimeout("go(0);",250000);
setTimeout("refreshdisable()",270000);
}

function refreshdisable()
{
window.location.replace("http://www.calendarmaui.com/top.php?display=1");
}

function moveto(myblock,x,y)
{
myblock.xpos = x
myblock.ypos = y
myblock.left = myblock.xpos
myblock.top = myblock.ypos
}

// Must recalculate the xinc and yinc before you move
function go(num) {
block.angle = num
block.xinc = 5*Math.cos(block.angle*Math.PI/180)
block.yinc = 5*Math.sin(block.angle*Math.PI/180)
slide()
}

function slide() {
if (block.count < 105) {
block.xpos += block.xinc
block.ypos -= block.yinc
block.left = block.xpos
block.top = block.ypos
block.count += 1
setTimeout("slide()",30)
}
else block.count = 0
}

function restart() {
block.count = 0
moveTo(block,150,150)
}

function moveTo(obj,x,y) {
obj.xpos = x
obj.ypos = y
obj.left = obj.xpos
obj.top = obj.ypos

But it looks more like a script to move something around. Where is the calendar script?

kuau
05-18-2008, 08:42 PM
I didn't realize you had replied.. thought you took off somewhere, so in the meantime I tweaked the css on the new calendar to look like the old calendar and plugged the generated code into the live page and it actually works (but not really). It is here:

www.calendarmaui.com/index.php (but in FF there is a piece of the shadow left)

If you click on a day it will go to the right day, but it is hardcoded - I would have to change the "selected" day every day. I tried including the new calendar code (which is now called calendar.php and is displayed above) and it actually dynamically creates the calendar, but if you click on a day it just reloads the home page. It is here:

http://www.calendarmaui.com/index-newcode.php

The code you have in your box is the code to float the Google ads across the top. Here is the old calendar code, but now that the calendar is css'd, it would probably be easier to just match up the variables in the new code to the old code. I tried changing year to day (because it is day.php that is working on the home page), but it didn't work. I can't really follow it very well. At least I made a bit of progress! :)


<table border="0" cellpadding="0" cellspacing="0">
<tr><td><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000" colspan="15"><img src="img/gr/blank.gif" width="1" height="1"></td></td></tr>
<tr><td><img src="img/gr/blank.gif" width="1" height="36"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td align="center" bgcolor="#EEEEEE"><h2><a href=index.php?date=<? echo"$month_ago"; ?>><img src=/img/gr/last.gif width=29 height=30 border=0></a></h2></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td colspan="9" align="center" bgcolor="#FFFFCC"><h2><?php echo month_name ( $thismonth - 1 ) . " $thisyear"?></h2></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td align="center" bgcolor="#EEEEEE"><h2><a href=index.php?date=<? echo"$month_ahead"; ?>><img src=/img/gr/next.gif width=29 height=30 border=0></a></h2></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#FFFFFF" align=left><img src="img/gr/topright.gif" width="7" height="36"></td>
</tr>
<tr>
<td><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#FFFFFF" background="img/gr/right.gif"><img src="img/gr/blank.gif" width="1" height="1"></td>
</tr>
<tr>
<td><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Sun</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Mon</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Tue</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Wed</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Thu</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Fri</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#ebefeb" align=center><font size=-1>Sat</font></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#FFFFFF" background="img/gr/right.gif"><img src="img/gr/blank.gif" width="1" height="1"></td>
</tr>
<tr>
<td><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>

<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="33" height="1"></td>
<td bgcolor="#000000"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#FFFFFF" background="img/gr/right.gif"><img src="img/gr/blank.gif" width="1" height="1"></td>
</tr>

<?php // generate values for first day and last day of month
$monthstart = mktime ( 2, 0, 0, $thismonth, 1, $thisyear );
$monthend = mktime ( 2, 0, 0, $thismonth + 1, 0, $thisyear );
if ( $WEEK_START == "1" )
$wkstart = get_monday_before ( $thisyear, $thismonth, 1 );
else
$wkstart = get_sunday_before ( $thisyear, $thismonth, 1 );
$wkend = $wkstart + ( 3600 * 24 * 7 );

for ( $i = $wkstart; date ( "Ymd", $i ) <= date ( "Ymd", $monthend );
$i += ( 24 * 3600 * 7 ) ) {
for ( $i = $wkstart; date ( "Ymd", $i ) <= date ( "Ymd", $monthend );
$i += ( 24 * 3600 * 7 ) ) {
if ($i != $wkstart ){
?>
<tr>
<td><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000" colspan="15"><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor=#FFFFFF background=/img/gr/right.gif><img src=/img/gr/blank.gif width=1 height=1></td>
</tr>
<?
}
echo "<tr><td><img src=/img/gr/blank.gif width=1 height=30></td>\n";
for ( $j = 0; $j < 7; $j++ ) {
$date = $i + ( $j * 24 * 3600 );
if ( date ( "Ymd", $date ) >= date ( "Ymd", $monthstart ) &&
date ( "Ymd", $date ) <= date ( "Ymd", $monthend ) ) {
if ( date ( "Ymd", $date ) == date ( "Ymd" ) )
echo "<td bgcolor=000000 width=1><img src=/img/gr/blank.gif width=1 height=30></td><TD width=33 BGCOLOR=\"FFFFCC\" ALIGN=CENTER>";
else
echo "<td bgcolor=000000 width=1><img src=/img/gr/blank.gif width=1 height=30></td><TD width=33 ALIGN=CENTER>";
echo "<A HREF=/day.php?date=" . date ( "Ymd", $date ) . "&top=0&page=0&query_save=SELECT+%2A+FROM+webcal_entry%2Cwebcal_entry_user+WHERE+webcal_entry.cal_date+%3E%3D" . date ( "Ymd", $date ) . "+AND+webcal_entry.cal_date%3C%3D" . date ( "Ymd", $date ) . "+AND+webcal_entry_user.cal_id%3Dwebcal_entry.cal_id+AND+webcal_entry_user.cal_login%3D%27whatdayisit%27+AND+webcal_entry_user.cal_status%3D%27A%27++ORDER+BY+cal _date >" .
date ( "d", $date ) .
"</A></TD>\n";
} else {
echo "<td width=1 bgcolor=000000><img src=/img/gr/blank.gif width=1 height=30></td><TD width=33>&nbsp;</TD>\n";
}
}
echo "<td bgcolor=000000><img src=/img/gr/blank.gif width=1 height=30></td><td bgcolor=#FFFFFF background=/img/gr/right.gif><img src=/img/gr/blank.gif width=1 height=1></td></TR>\n";
}
}
?>

<tr><td><img src="img/gr/blank.gif" width="1" height="1"></td>
<td bgcolor="#000000" colspan="15"><img src="img/gr/blank.gif" width="1" height="1"></td></tr>
<tr><td colspan=3 background=/img/gr/botleft.gif><img src="img/gr/botleft2.gif" width="35" height="7"></td>
<td background=/img/gr/bot.gif colspan="10"><img src="img/gr/blank.gif" width="1" height="7"></td>
<td colspan=3 background="img/gr/bot.gif"><img src="img/gr/blank.gif" width="42" height="7"></td>
<td bgcolor=#FFFFFF background=/img/gr/botright.gif><img src=/img/gr/blank.gif width=7 height=7></td></tr>
</table>

kuau
05-19-2008, 06:59 AM
Yikes, I am really over my head now. Here is the code I am including on the homepage instead of the old code, which I'm hoping will automatically change the date at midnight (I'm praying), but the < and > at the top of the calendar go to the day in the last/next month instead of the month. At this point I would almost rather go back to the old code, which is starting to make more sense to me - I really have no clue how to follow this new code - but the old code looks awful in FF. I'm between a rock and a hard place, as they say. I need to get it stabilized so I can research the best option going forward:
1. Upgrade this old WebCalendar (2001) to the 2008 WebCalendar (at least the data might be adaptable to the newer database structure).
2. Try a whole new calendar package like Joomla with Thyme or JEvents, or Helios (importing the data may be a challenge). I'm not familiar with any of the options so I'm not sure which way to go. Any suggestions? Thanks.


<?php

/* $hc_calStartDay = 1; // Calendar First Day of the Week */
?>
<form name="frmJump" id="frmJump" action="">
<table cellpadding="0" cellspacing="0" border="0" class="miniCalTable" align="center">
<?php
if(isset($_GET['day']) && is_numeric($_GET['day'])){
$curDay = $_GET['day'];
} else {
$curDay = date("d");
}//end if

if(isset($_GET['month']) && is_numeric($_GET['month'])){
$curMonth = $_GET['month'];
} else {
$curMonth = date("n");
}//end if

if(isset($_GET['year']) && is_numeric($_GET['year'])){
$curYear = $_GET['year'];
} else {
$curYear = date("Y");
}//end if

if(($curMonth < date("n") && $curYear == date("Y")) && $hc_browsePast == 0){
$curMonth = date("n");
} elseif(($curYear < date("Y")) && $hc_browsePast == 0){
$curMonth = date("n");
$curYear = date("Y");
}//end if

/* $query = " SELECT DISTINCT e.StartDate
FROM events e
LEFT JOIN eventcategories ec ON (e.PkID = ec.EventID)
LEFT JOIN locations as l ON (e.LocID = l.PkID)
WHERE e.IsActive = 1 AND
e.IsApproved = 1 AND
(e.StartDate BETWEEN '" . date("Y-m-d", mktime(0,0,0,$curMonth,1,$curYear)) . "' AND '" . date("Y-m-d", mktime(0,0,0,$curMonth+1,0,$curYear)) . "')";

if(isset($_SESSION['hc_favCat']) && $_SESSION['hc_favCat'] != ''){
$query = $query . " AND ec.CategoryID in (" . $_SESSION['hc_favCat'] . ") ";
}//end if

if(isset($_SESSION['hc_favCity']) && $_SESSION['hc_favCity'] != ''){
$query = $query . " AND (e.LocationCity IN (" . $_SESSION['hc_favCity'] . ") OR l.City IN (" . $_SESSION['hc_favCity'] . "))";
}//end if

$query = $query . " ORDER BY StartDate";
$result = doQuery($query);

$events[] = "";
if(hasRows($result)){
while($row = mysql_fetch_row($result)){
$events[] = stampToDate($row[0], "d");
}//end while
}//end if
*/
$navBackMonth = ($curMonth-1) % 12;
$navBackYear = $curYear;
$navForwMonth = ($curMonth+1) % 12;
$navForwYear = $curYear;
if($curMonth == 1){
$navBackMonth = 12;
$navBackYear = $curYear - 1;
} elseif($curMonth == 11) {
$navForwMonth = 12;
} elseif($curMonth == 12){
$navForwYear = $curYear + 1;
}//end if
?> <tr>
<td class="miniCalNav" onclick="window.location.href='/day.php?year=<?php echo $navBackYear?>&amp;month=<?php echo $navBackMonth;?>';">&lt;</td>
<td class="miniCalTitle" colspan="5">
<select name="jumpMonth" id="jumpMonth" class="miniCalJump" onchange="window.location.href=document.frmJump.jumpMonth.value;">
<?php $jumpMonth = date("n", mktime(0,0,0,$curMonth-12,1,$curYear));
$jumpYear = date("Y", mktime(0,0,0,$curMonth-12,1,$curYear));
for($i = 0; $i < 25; $i++){ ?>
<option <?php if($i == 12){echo "selected=\"selected\"";}?> value="/day.php?year=<?php echo date("Y", mktime(0,0,0,$jumpMonth + $i,1,$jumpYear));?>&amp;month=<?php echo date("n", mktime(0,0,0,$jumpMonth + $i,1,$jumpYear));?>"><?php echo date("M Y", mktime(0,0,0,$jumpMonth + $i,1,$jumpYear));?></option>
<?php }//end for?>
</select>
</td>
<td class="miniCalNav" onclick="window.location.href='/day.php?year=<?php echo $navForwYear?>&amp;month=<?php echo $navForwMonth;?>';">&gt;</td>
</tr>
<?php $d = $hc_calStartDay;

echo "<tr>";
$daysOfWeek = array(0 => "Sun", 1 => "Mon", 2 => "Tue", 3 => "Wed", 4 => "Thu", 5 => "Fri", 6 => "Sat");
for($i = 0; $i < 7; $i++){ ?>
<td class="miniCalDOW"><?php echo $daysOfWeek[$d % 7];?></td>
<?php $d++;
}//end for
echo "</tr><tr>";

$fillCnt = date("w", mktime(0,0,0,$curMonth,1,$curYear));
if($hc_calStartDay > 0){
if($hc_calStartDay <= date("w", mktime(0,0,0,$curMonth,1,$curYear))){
$fillCnt = $fillCnt - $hc_calStartDay;
} else {
$fillCnt = 7 - ($hc_calStartDay - $fillCnt);
}//end if
}//end if

for($i = 0; $i < $fillCnt; $i++){ ?>
<td class="miniCalFiller">&nbsp;</td>
<?php }//end for

for($x = 0; $x < date("t", mktime(0,0,0,$curMonth,1,$curYear)); $x++){
if($i % 7 == 0){echo "</tr><tr>";}?>
<td <?php if(($x+1 == date("d")) && (date("m") == $curMonth) && (date("Y") == $curYear)){?>class="miniCalToday"<?php }elseif(in_array($x+1, $events)){?>class="miniCalEvents"<?php }else{?>class="miniCal"<?php }?> onclick="window.location.href='/day.php?year=<?php echo $curYear?>&amp;month=<?php echo $curMonth;?>&amp;day=<?php echo $x+1;?>';"><?php echo date("d", mktime(0,0,0,$curMonth,$x+1,$curYear));?></td>
<?php $i++;
}//end for

if($i % 7 > 0){
for($i = $i % 7; $i < 7; $i++){ ?>
<td class="miniCalFiller">&nbsp;</td>
<?php }//end for
}//end if ?>
</tr>
</table>
</form>