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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    w3validator error

    i have index.php which includes new_products.php is below. i have 65 errors in index.php in w3validator.

    i added ", $new_products['fr_currencies_id']" which to calculate price with a variable. after i deleted this variable, i could not see any error. i am curious, fr_currencies is a number between 1 and 3. it is a multipier, it multipies tax class and products naked price. how can effect or disorder div tag. this is a number, how can it effect a div tag order?

    w3validator error says you can not put <div> in <a> unless use <a class. if everything works perfect without fr curriency,

    i have 18 new products in index.php. the errors are clasified in two groups. it is quite clean, one product produces 3 or more errors. error groups are below.

    end tag for X omitted, but OMITTAG NO was
    document type does not allow element X here; missing


    --------------------------------------------------
    $p_price = '<span class="productSpecialPrice">' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']), $new_products['fr_currencies_id']) . '</span>';
    --------------------------------------------------
    new_products.php
    <?php

    $findlastnumber= tep_db_query("select * from " . TABLE_PRODUCTS . " order by products_date_added DESC limit 1");
    $getlastnumber= tep_db_fetch_array($findlastnumber);
    $lastnumber= ($getlastnumber['products_id'] - '500');


    if ($first_page === true){
    if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

    list($usec, $sec) = explode(' ', microtime());
    srand( (float) $sec + ((float) $usec * 100000) );
    $mtm= rand();
    $new_products_query = tep_db_query("select p.products_id, p.products_image, p.fr_currencies_id, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and
    p.products_id > ".$lastnumber." order by rand($mtm) DESC limit " . MAX_DISPLAY_PRODUCTS_FIRST_PAGE);
    // p.products_last_modified desc limit " . MAX_DISPLAY_PRODUCTS_FIRST_PAGE)
    } else {
    $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.fr_currencies_id, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and
    p.products_id > ".$lastnumber." order by rand($mtm) DESC limit " . MAX_DISPLAY_PRODUCTS_FIRST_PAGE);
    // p.products_last_modified desc limit " . MAX_DISPLAY_PRODUCTS_FIRST_PAGE);
    }
    }else{
    if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
    $new_products_query = tep_db_query("select p.products_id, p.products_image, p.fr_currencies_id, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and
    p.products_id > ".$lastnumber." order by rand($mtm) DESC limit " . MAX_DISPLAY_NEW_PRODUCTS);
    //p.products_last_modified desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
    } else {
    $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.fr_currencies_id, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and
    p.products_id > ".$lastnumber." order by rand($mtm) DESC limit " . MAX_DISPLAY_NEW_PRODUCTS);
    //p.products_last_modified desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
    }
    }
    $col = 0;
    $row = 0;

    if ($first_page == 0){
    $col_items = (MAX_DISPLAY_NEW_PRODUCTS_PER_ROW - 1);
    $colspan = ((MAX_DISPLAY_NEW_PRODUCTS_PER_ROW * 2) - 1);
    }else{
    $col_items = (MAX_DISPLAY_NEW_PRODUCTS_PER_ROW_FIRST_PAGE - 1);
    $colspan = ((MAX_DISPLAY_NEW_PRODUCTS_PER_ROW_FIRST_PAGE * 2) - 1);
    }
    $col_width = (int)(100 / ($col_items + 1)).'%';

    $new_prods_content .= '<div class="prods_content prods_table">';
    while ($new_products = tep_db_fetch_array($new_products_query)) {

    if (($col === 0) && ($row != 0)) {
    $new_prods_content .= '<ul><li class="prods_hseparator">'.tep_draw_separator('spacer.gif', '1', '1').'</li></ul>';
    }
    if ($col === 0) {
    $new_prods_content .= '<ul class="row" id="row-'.$row.'">';
    }else {
    $new_prods_content .= '<li class="prods_vseparator">'.tep_draw_separator('spacer.gif', '1', '1').'';
    }
    // *************************************
    // *************************************
    $product_query = tep_db_query("select products_description, products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$new_products['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
    $product = tep_db_fetch_array($product_query);
    $p_id = $new_products['products_id'];

    $p_pic = '<a class="prods_pic_bg" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '" style="width:'.(SMALL_IMAGE_WIDTH + PIC_MARG).'px;height:'.(SMALL_IMAGE_HEIGHT + PIC_MARG).'px;">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], (SMALL_IMAGE_WIDTH + PIC_MARG), (SMALL_IMAGE_HEIGHT + PIC_MARG), ' style="width:'.(SMALL_IMAGE_WIDTH +PIC_MARG).'px;height:'.(SMALL_IMAGE_HEIGHT + PIC_MARG).'px;margin:'.PIC_MARG2.'px 0px 0px '.PIC_MARG2.'px;"') . '';

    $p_name = '<span><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></span>';
    $p_desc = ''. mb_substr(strip_tags($product['products_description']), 0, MAX_DESCR_MODUL_NEW_PRODS).'...';
    --------------------------------------------------
    $p_price = '<span class="productSpecialPrice">' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']), $new_products['fr_currencies_id']) . '</span>';
    --------------------------------------------------
    // *************************************

    if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($new_products['products_id']) < 1)) {
    $p_details_text = '<div class="bg_button22" onmouseout="this.className=\'bg_button22\';" onmouseover="this.className=\'bg_button22-act\';">' .tep_draw_button_top() . '<a href="' . tep_href_link('product_info.php?products_id='.$p_id) . '" id="tdb1" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary ui-priority-secondary" role="button"><span class="ui-button-icon-primary ui-icon ui-icon-triangle-1-e"></span><span class="ui-button-text">'. IMAGE_BUTTON_DETAILS .'</span></a>' . tep_draw_button_bottom().'</div>';
    $p_buy_now = '<a class="bg_button22" onmouseout="this.className=\'bg_button22\';" onmouseover="this.className=\'bg_button22-act\';" href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$p_id).'">'.tep_image_button( 'button_out_cart.gif', '', ' class="btn1"').'</a>';
    } else {
    $p_buy_now = '<a class="bg_button22" onmouseout="this.className=\'bg_button22\';" onmouseover="this.className=\'bg_button22-act\';" href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$p_id).'">'.tep_image_button( 'button_in_cart.gif', '', ' class="btn1"').'</a>';
    }
    // *************************************
    // *************************************

    $new_prods_content .= '<li style="width:'.PRODS_BLOCK_WIDTH.'px;" class="wrapper_prods">'.

    ' <div class="pic_padd wrapper_pic_div" style="width:'.(SMALL_IMAGE_WIDTH + PIC_MARG).'px;height:'.(SMALL_IMAGE_HEIGHT + PIC_MARG).'px;">'.$p_pic.''.tep_draw_prod_pic_top().''.tep_draw_prod_pic_bottom().'</a></div>'. "\n".
    ' <div class="name name_padd equal-height">'.$p_name.'</div>'. "\n".
    ' <div class="box-padd ofh">'. "\n".
    ' <div class="price un">'.$p_price.'</div>'. "\n".
    ' <div class="fl_right">'.$p_buy_now.'</div>'. "\n".
    ' </div>'. "\n";

    $col ++;
    if ($col > $col_items) {
    $new_prods_content .= '</ul>';
    $row ++;
    $col = 0;
    }else{
    $new_prods_content .= '</li>';
    }
    }

    $new_prods_content .= '</div>';
    ?>
    <?php echo tep_draw_title_top();?>
    <h1 class="cl_both "><?php echo sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')); ?></h1>
    <?php echo tep_draw_title_bottom();?>
    <div class="contentPadd">

    <?php echo $new_prods_content; ?>
    </div>

    <script type="text/javascript">
    $(document).ready(function(){
    var row_list = $('.row');
    row_list.each(function(){
    new equalHeights($('#' + $(this).attr("id")));
    });
    })
    $(document).ready(function(){
    var row_list2 = $('.row2');
    row_list2.each(function(){
    // console.log($(this))
    new equalHeights2($('.sub_categories'));
    });
    })
    </script>

  • #2
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,332
    Thanks
    5
    Thanked 363 Times in 360 Posts
    You should be validating your browser rendered source code. The php code will be stripped by the php application server, and only plain html code will be rendered in the browser. The validator is of course not going to like some of those special characters server side languages use.
    Teed


  •  

    Posting Permissions

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