SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2009
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    validating some code outputted by php

    Hello all:

    The site in question is: Test1 ChuprinaStudios

    When validating I get this message 11 times for the eleven images being used:
    Line 99, Column 89: Bad value fncbx for attribute rel on element a: Keyword fncbx is not registered.
    …ass="fancybox" rel="fncbx" href="img/original/pitcher.jpg" target="_blank"></a>
    Syntax of link type valid for <a> and <area>:
    A whitespace-separated list of link types listed as allowed on <a> and <area> in the HTML specification or listed as an allowed on <a> and <area> on the Microformats wiki without duplicate keywords in the list. You can register link types on the Microformats wiki yourself.
    I actually have no idea on this one. and am not sure what it really says....

    The php code calling for those images is:
    PHP Code:
    <?php
                            
    /* Configuration Start */
                            
    $thumb_directory 'img/thumbs';
                            
    $orig_directory 'img/original';
                            
    $deg2radians pi() * 360;
                            
    $rad $rot $deg2radians;
                            
    $cosTheta cos($rad);
                            
    $sinTheta sin($rad);
                            
    $stage_width=500;    // How big is the area the images are scattered on
                            
    $stage_height=400;
                            
    /* Configuration end */
        
                            
    $allowed_types=array('jpg','jpeg','gif','png');
                            
    $file_parts=array();
                            
    $ext='';
                            
    $title='';
                            
    $i=0;
                            
        
                            
    /* Opening the thumbnail directory and looping through all the thumbs: */
        
                            
    $dir_handle = @opendir($thumb_directory) or die("There is an error with your image directory!");
                            
    $i=1;
                            while (
    $file readdir($dir_handle)) 
                                {
                                    
    /* Skipping the system files: */
                                    
    if($file=='.' || $file == '..') continue;
                                    
    $file_parts explode('.',$file);
                                    
    $ext strtolower(array_pop($file_parts));
        
                                    
    /* Using the file name (withouth the extension) as a image title: */
                                    
    $title implode('.',$file_parts);
                                    
    $title htmlspecialchars($title);
        
                                    
    /* If the file extension is allowed: */    
                                    
    if(in_array($ext,$allowed_types))
                                        {
                                            
    /* Generating random values for the position and rotation: */
                                            
    $left=rand(0,$stage_width);
                                            
    $top=rand(0250);
                                            
    $rot rand(-40,40);
                
                                            if(
    $top>$stage_height-130 && $left $stage_width-230)
                                                {
                                                
    /* Prevent the images from hiding the drop box */
                                                
    $top-=120+130;
                                                
    $left-=230;
                                                }
                
            
    /* Outputting each image: */
            
    echo '
                <div id="pic-'
    .($i++).'" class="pic" style="top:'.$top.'px;left:'.$left.'px;background:url('.$thumb_directory.'/'.$file.') no-repeat 50% 50%; -moz-transform:rotate('.$rot.'deg); -webkit-transform:rotate('.$rot.'deg);">
         
                <a class="fancybox" rel="fncbx" href="'
    .$orig_directory.'/'.$file.'" target="_blank"></a>
         
                </div>'
    ;
            }
        }    
                            
    /* Closing the directory */
                            
    closedir($dir_handle);
        
                            
    ?>
    But the area I think the error is in is:
    PHP Code:
    <class="fancybox" rel="fncbx" href="'.$orig_directory.'/'.$file.'" target="_blank"></a
    I have no idea what is causing this validation error. Any help, assistance, or code is greatly appreciated.

    PChuprina

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Well, by the looks of that error, you may just need to remove the rel (rel="fncbx") attribute from the link.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    This seems to be a question about an online html validator, maybe validating the new shema.org microdata?

    PHP seems to be doing its job and outputting what you want, its just that what you want is illegal in terms of your validator. The spec of the schema you are checking against is probably the place to look first.


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
  •