Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts

    html tables and calander...

    for some reason anything after my caladener recarding html table structures gets broken... have i got something wrong with my html markup??

    Code:
    <table cellpadding="1" cellspacing="1" border="0" bgcolor="#<? echo $bg_edge; ?>"> 
    <tr><td colspan="7" bgcolor="#<? echo $bg_top; ?>"> 
    <table cellpadding="1" cellspacing="1" border="0" width="100%"> 
    <tr bgcolor="#<? echo $bg_top; ?>"><th width="20" style="<?php echo $hcell; ?>"><a href="<? echo $_SERVER['PHP_SELF']; ?>?m=<?=(($m-1)<1) ? 12 : $m-1 ?>&amp;y=<?=(($m-1)<1) ? $y-1 : $y ?>"><img src='http://www.runningprofiles.com/calendar/images/prev.gif' height='18' width='18' alt='' border='0' /></a></th> 
    <th style="<?php echo $hcell; ?>">
    <?php
    echo  "<a href='../diary/show-month.php?mon=". $m. "&amp;yr=". $y. "'rel=\"facebox\">";
    echo "<span style='text-decoration:none'>". $mo[intval($m)]. " ". $y. "</span></a>";
    ?>
    </th> 
    <th width="20" style="<? echo $hcell; ?>"><a href="<? echo $_SERVER['PHP_SELF']; ?>?m=<?=(($m+1)>12) ? 1 : $m+1 ?>&amp;y=<?=(($m+1)>12) ? $y+1 : $y ?>"><img src='http://www.runningprofiles.com/calendar/images/next.gif' height='18' width='18' border='0' alt='' /></a></th> 
    </tr>
    </table> 
    </td></tr> 
    <tr bgcolor="#<? echo $bg_top; ?>">
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[1]; ?></th>
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[2]; ?></th> 
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[3]; ?></th>
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[4]; ?></th>
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[5]; ?></th>
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[6]; ?></th> 
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[7]; ?></th>
    </tr>
    <?  
    $d = 1; 
    $wday = $firstwday; 
    $firstweek = true; 
    /*== loop through all the days of the month ==*/ 
    while ( $d <= $lastday) 
    { 
        /*== set up blank days for first week ==*/ 
        if ($firstweek) 
        {
            if ($wday!=0) {     
                echo "<tr bgcolor='#". $bg_tabl. "'>\n";
                for ($i=1; $i<=$firstwday; $i++) { 
                     echo "<td style='". $tcell. "' bgcolor='#". $bg_fill. "'>&nbsp;</td>\n"; 
                }
            }
            /*== Sunday start week with <tr> ==*/ 
            else { 
                echo "<tr bgcolor='#". $bg_tabl. "'>\n";
            } 
            $firstweek = false;
        }
        /*== check for event ==*/   
        echo "<td style='". $tcell. "' ";
        // is this day 'today' AND there's no event today
        if (($ty==$y) && ($tm==$m) && ($td == $d) && (!$ev_dat[$d])) { 
            echo "bgcolor='#". $bg_now. "'>". $d;
        }
        elseif ($ev_dat[$d]) {
            // get what's happening that day and use as 'mouseOver' for the link
            $query = "SELECT * FROM $db_table WHERE id=$ev_dat[$d] ";
            $result = mysql_query($query); 
            $ev = mysql_fetch_array($result);
            $titl = $ev['ev_title'];
            echo "bgcolor='#". $bg_act. "'>";
           $url = "../diary/show.php?event=". $ev_dat[$d]. "&amp;sho=". $win_sho;
          
                 echo "<a href=' $url' rel=\"facebox\" title=\"". $titl. "\">". $d. "</a>";
           
        }
        else {
            echo "bgcolor='#". $bg_days. "'>". $d; 
        }
        echo "</td>\n"; 
    
        /*== Saturday end week with </tr> ==*/ 
        if ($wday==6) {
            echo "</tr>\n"; 
        }
        $wday++; 
        $wday = $wday % 7; 
        if (($wday==0) AND ($d!=$lastday)){ echo "<tr bgcolor='#". $bg_tabl. "'>\n"; }
            $d++; 
        }
        // and close off the table
        if (($wday!=7) AND ($wday!=0)) {
            for ($i=$wday; $i<=6; $i++) {
                echo "<td style='". $tcell. "' bgcolor='#". $bg_fill. "'>&nbsp;</td>\n";
            }
            echo "</tr>";
        } 
    echo "\n</table>";
    sorry about all the php ect inbetween

  • #2
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    quickly broke it donw to an easyer read for u guys

    Code:
    <table cellpadding="1" cellspacing="1" border="0" bgcolor="#<? echo $bg_edge; ?>"> 
    <tr><td colspan="7" bgcolor="#<? echo $bg_top; ?>"> 
    <table cellpadding="1" cellspacing="1" border="0" width="100%"> 
    <tr bgcolor="#<? echo $bg_top; ?>"><th width="20" style="<?php echo $hcell; ?>">test</th> 
    <th style="<?php echo $hcell; ?>">
    </th> 
    <th width="20" style="<? echo $hcell; ?>">test</th> 
    </tr>
    </table> 
    </td></tr> 
    <tr bgcolor="#<? echo $bg_top; ?>">
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[1]; ?></th>
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[2]; ?></th> 
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[3]; ?></th>
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[4]; ?></th>
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[5]; ?></th>
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[6]; ?></th> 
    <th width="20" style="<?php echo $hcell; ?>"><? echo $da[7]; ?></th>
    </tr>
    
    <tr bgcolor='#". $bg_tabl. "'>
                <td style='". $tcell. "' bgcolor='#". $bg_fill. "'>&nbsp;</td>
    				 <tr bgcolor='#". $bg_tabl. "'>
        <td style='". $tcell. "'> 
      <tr bgcolor='#". $bg_now. "'>
    		<tr bgcolor='#". $bg_act. "'>
        <td bgcolor='#". $bg_days. "'>
    </td> 
    </tr> 
     <tr bgcolor='#". $bg_tabl. "'>
    
    <td style='". $tcell. "' bgcolor='#". $bg_fill. "'>&nbsp;</td>
          
            </tr>
    </table>

  • #3
    Regular Coder
    Join Date
    May 2009
    Posts
    143
    Thanks
    14
    Thanked 1 Time in 1 Post
    what will $da[1]; print out?

  • #4
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    the date so 1-31 ect dependat on the month


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •