SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    ********* Streaker Lister14's Avatar
    Join Date
    Jun 2002
    Location
    C:\Documents and Settings\Desktop\Recycle Bin
    Posts
    677
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problems validating <th> / <td>

    hi there,

    this is what the xhtml checker tells me:
    Code:
    Line 102, column 16: an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified
    
    <tr><td colspan=7 class="calendar-month">August&nbsp;2005</td>
    
    Line 103, column 22: document type does not allow element "th" here; assuming missing "tr" start-tag
    
    </tr><th abbr="Monday">Mo</th><th abbr="Tuesday">Tu</th><th abbr="Wednesday">We<
    its a script for a calendar which i "borrowed":

    PHP Code:
    # PHP Calendar (version 2.3), written by Keith Devens
    # http://keithdevens.com/software/php_calendar
    #  see example at http://keithdevens.com/weblog
    # License: http://keithdevens.com/software/license

    function generate_calendar($year$month$days = array(), $day_name_length 3$month_href NULL$first_day 0$pn = array()){
        
    $first_of_month gmmktime(0,0,0,$month,1,$year);
        
    # remember that mktime will automatically correct if invalid dates are entered
        # for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
        # this provides a built in "rounding" feature to generate_calendar()

        
    $day_names = array(); #generate all the day names according to the current locale
        
    for($n=0,$t=(3+$first_day)*86400$n<7$n++,$t+=86400#January 4, 1970 was a Sunday
            
    $day_names[$n] = ucfirst(gmstrftime('%A',$t)); #%A means full textual day name

        
    list($month$year$month_name$weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));
        
    $weekday = ($weekday $first_day) % 7#adjust for $first_day
        
    $title   htmlentities(ucfirst($month_name)).'&nbsp;'.$year;  #note that some locales don't capitalize month and day names

        # Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
        
    @list($p$pl) = each($pn); @list($n$nl) = each($pn); #previous and next links, if applicable
        
    if($p$p '<span class="calendar-prev">'.($pl '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' $p).'</span>&nbsp;';
        if(
    $n$n '&nbsp;<span class="calendar-next">'.($nl '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' $n).'</span>';
        
    $calendar '<table class="calendar">'."\n".
            
    '<tr><td colspan=7 class="calendar-month">'.$p.($month_href '<a href="'.htmlspecialchars($month_href).'">'.$title.'</a>' $title).$n."</td>\n</tr>";

        if(
    $day_name_length){ # if the day names should be shown ($day_name_length > 0)
            # if day_name_length is >3, the full name of the day will be printed
            
    foreach($day_names as $d)
                
    $calendar .= '<th abbr="'.htmlentities($d).'">'.htmlentities($day_name_length substr($d,0,$day_name_length) : $d).'</th>';
            
    $calendar .= "</tr>\n<tr>";
        }

        if(
    $weekday 0$calendar .= '<td colspan="'.$weekday.'">&nbsp;</td>'#initial 'empty' days
        
    for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month$day++,$weekday++){
            if(
    $weekday == 7){
                
    $weekday   0#start a new week
                
    $calendar .= "</tr>\n<tr>";
            }
            if(isset(
    $days[$day]) and is_array($days[$day])){
                @list(
    $link$classes$content) = $days[$day];
                if(
    is_null($content))  $content  $day;
                
    $calendar .= '<td'.($classes ' class="'.htmlspecialchars($classes).'">' '>').
                    (
    $link '<a href="'.htmlspecialchars($link).'">'.$content.'</a>' $content).'</td>';
            }
            else 
    $calendar .= "<td>$day</td>";
        }
        if(
    $weekday != 7$calendar .= '<td colspan="'.(7-$weekday).'">&nbsp;</td>'#remaining "empty" days

        
    return $calendar."</tr>\n</table>\n";

    any help appreciated


    lister
    roy.lu
    C:\DOS... C:\DOS\RUN... RUN\DOS\RUN...!

  2. #2
    SitePoint Wizard LiquidReflex's Avatar
    Join Date
    Aug 2003
    Location
    Minnesota
    Posts
    1,861
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Add quotes to your colspan entry ... instead of colspan=7 it should be colspan="7". Not sure if that is your exact issue, but that was the first thing I noticed.

    Also, you end a </tr> and you probably need to start another <tr> before starting the <th> tags. Add a <tr> and see if that helps too. (at least that's what the validator suggests)
    Kevin Hauge : Modern Leaf Design : Follow Us on Facebook
    Client Axis v.08 - client / project management script

  3. #3
    ********* Streaker Lister14's Avatar
    Join Date
    Jun 2002
    Location
    C:\Documents and Settings\Desktop\Recycle Bin
    Posts
    677
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi there,

    got it!!

    thanks a lot mate


    lister
    roy.lu
    C:\DOS... C:\DOS\RUN... RUN\DOS\RUN...!

  4. #4
    SitePoint Wizard LiquidReflex's Avatar
    Join Date
    Aug 2003
    Location
    Minnesota
    Posts
    1,861
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    No problem. Glad that fixed it.
    Kevin Hauge : Modern Leaf Design : Follow Us on Facebook
    Client Axis v.08 - client / project management script


Bookmarks

Posting Permissions

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