Annoying Home Page Validation (Just one Error)
I can't seem to figure out what's causing this error on the home page of www.silkblooms.co.uk:
"line 443 column 3 - Error: document type does not allow element "ul" here; assuming missing "li" start-tag"
Can anyone see what's causing it? It's quite annoying to have just one validation error on the home page. Would love to have none :)
Re: Annoying Home Page Validation (Just one Error)
It looks to me as though you need a <li> just before the <ul> in line 443. There's a closing </li> in line 473 without an opening tag
I've just tried it and it seems to work.
Re: Annoying Home Page Validation (Just one Error)
Quote:
Originally Posted by
simon1066
It looks to me as though you need a <li> just before the <ul> in line 443. There's a closing </li> in line 473 without an opening tag
I've just tried it and it seems to work.
Thanks for the reply. New question. Which file is generating line 473? I tried to track it down and it was leading me to /includes/functions/extra_functions/categories_dressing_functions.php as this is one of the few files with a <ul>
Adding a <li> just before it didn't cure the problem, it created another (2 validation errors)........ sop probably not the correct file?
Re: Annoying Home Page Validation (Just one Error)
All I did to cure the error was to input the <li> into the source at validator.w3.org - it then validated ok, I've had similar problems like this in the past and as li/ul's can be from different files it can be pretty difficult to track down the correct location for such missing tags. I can only suggest to perhaps find the file that has the closing </li> (on line #473 in the 'show source' section of the validator) and see if that file is an appropriate place to add the missing tag to.
Sorry can't be of more help here.
Re: Annoying Home Page Validation (Just one Error)
Actually, you need a closing </ul> before the <ul> that's on line 443.
Code:
<!--// bof: chcategories //-->
<div class="leftBoxContainer" id="chcategories" style="width: 190px">
<h3 class="leftBoxHeading" id="chcategoriesHeading">Wedding Flowers</h3>
<div id="chcategoriesContent" class="sideBoxContent">
<ul class="catLinks"><li><a class="category-links" href="http://www.silkblooms.co.uk/index.php?main_page=products_new">New Products ...</a></li>
</ul><ul>
<li><div class="catBoxHeading3"> <a href="index.php?main_page=coming_soon">Coming Soon ...</a></div></li>
<li class="cat-top"><a class="cat-not-selected-text" href="http://www.silkblooms.co.uk/index.php?main_page=index&cPath=349">Hire Products ...</a></li>
<li><hr class="catBoxDivider1" /></li>
<li class="cat-bolder"><a class="cat-not-selected-text" href="http://www.silkblooms.co.uk/index.php?main_page=index&cPath=1">All Products ...</a></li>
<ul>
<li class="cat-products"><a class="cat-not-selected-text" href="http://www.silkblooms.co.uk/index.php?main_page=index&cPath=1_6">Bridal Bouquets</a></li>
And that code appears to be generated from within the "chcategories" addon you're using.
Re: Annoying Home Page Validation (Just one Error)
Something's telling me it's in this file, but I can't seem to fix it. Everything I try seems to make it worse. Can you see anything in this file that can be causing it?
PHP Code:
<?php
/**
* @copyright Copyright 2009 Glenn Herbert
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.gnu.org/licenses/ GNU Public License V3.0
* includes/functions/extra_functions/categories_dressing_functions.php
* Categories Dressing v2.6 - Glenn Herbert (gjh42) - 20090128
*/
function cat_active_level_manage($path) {
$skip_cat = 0;
if (defined('CAT_BOX_ACTIVE_LEVEL')) {
$cat_box_active_level = explode('|',constant('CAT_BOX_ACTIVE_LEVEL'));
$current_top = (int)$_GET['cPath'];
$iteration_top = (int)$path; // set = this iteration's topcat
$cat_depth = substr_count($path,'_');
//tests for various kinds of skipping - more can be added
$skip_cat = $skip_cat + ($cat_box_active_level[0] == 1 and $current_top != $iteration_top)?1:0;
$skip_cat = $skip_cat + ($cat_box_active_level[0] == 2 and $current_top != $iteration_top and $current_top != 0)?1:0;
$skip_cat = $skip_cat + ($cat_box_active_level[1] > $cat_depth and $cat_box_active_level[0] != 2)?1:0;
$skip_cat = $skip_cat + ($cat_box_active_level[2] < $cat_depth)?1:0;
}//defined
return $skip_cat;
}
function cat_ul_manage($current_path, &$prev_cat_depth, $new_group) {
$ul_content = '';
$cat_depth = substr_count($current_path,'_');
if ($cat_depth > $prev_cat_depth) {
$ul_content .= str_repeat('<ul>',(($cat_depth - $prev_cat_depth) - $new_group)) . "\n";
} elseif ($cat_depth < $prev_cat_depth) {
$ul_content .= str_repeat('</ul>',(($prev_cat_depth - $cat_depth) + $new_group)) . "\n";
} else {
$ul_content .= $new_group?'</ul>':'';
}
$ul_content .= $new_group?'<ul id="catGroup' . $current_path . '">' . "\n":'';
$prev_cat_depth = $cat_depth;
return $ul_content;
}
function cat_box_heading($current_path) {
$heading_content = '';
$new_group = 0;
if (defined('CAT_BOX_HEADING_' . $current_path)) {
$cat_box_heading = explode('|',constant('CAT_BOX_HEADING_' . $current_path));
if ($cat_box_heading[0]) {
$new_group = 1;
}
if ($cat_box_heading[1]) {
$heading_content .= '<hr class="catBoxDivider' . $cat_box_heading[1] . '" />' . "\n";
}
if ($cat_box_heading[2]) {
//display image if exists for category name in current language - with title tag
$heading_content .= file_exists(DIR_WS_TEMPLATE . 'buttons/' . $_SESSION['language'] . '/' . $cat_box_heading[2]) ? '<div class="catBoxHeadingImg">' . zen_image(DIR_WS_TEMPLATE . 'buttons/' . $_SESSION['language'] . '/' . $cat_box_heading[2], $cat_box_heading[3]) . '</div>' . "\n":$cat_box_heading[3] . "\n";
}
$i=4;
while ($i<(sizeof($cat_box_heading)-1)) {
$heading_content .= '<div class="catBoxHeading' . $cat_box_heading[$i+1] . '">' . $cat_box_heading[$i] . '</div>' . "\n";
$i = $i+2;
}
}
return array($new_group,$heading_content);
}
function cat_name_display($cat_name_display, $current_path) {
$cat_img_bg = '';
//display image if exists for category name in current language - with title tag
if (file_exists(DIR_WS_TEMPLATE . 'buttons/' . $_SESSION['language'] . '/catimg' . $current_path . '.gif')) {
$cat_name_display = zen_image(DIR_WS_TEMPLATE . 'buttons/' . $_SESSION['language'] . '/catimg' . $current_path . '.gif', '', '', '', 'title="' . $cat_name_display . '"');
//display background image if exists for category name in current language - with title tag
} elseif (file_exists(DIR_WS_TEMPLATE . 'buttons/' . $_SESSION['language'] . '/catbg' . $current_path . '.gif')) {
$cat_name_display = zen_image(DIR_WS_TEMPLATE_IMAGES . 'pixel_trans.gif', '', '100%', '100%', 'title="' . $cat_name_display . '"');
$cat_img_bg = ' catBg' . $current_path;
} else {
$cat_img_bg = '-text';//append to main classname
}
return array($cat_img_bg, $cat_name_display);
}
function cat_box_subtext($current_path) {
$subtext = '';
if (defined('CAT_BOX_SUBTEXT_' . $current_path)) {
$cat_box_subtext = explode('|',constant('CAT_BOX_SUBTEXT_' . $current_path));
$subtext .= '<div class="catBoxSubtext' . $cat_box_subtext[1] . '">' . $cat_box_subtext[0] . '</div>' . "\n";
}
return $subtext;
}
?>
Re: Annoying Home Page Validation (Just one Error)
Replace the obsolete v2.6 of Categories Dressing with the latest released v2.7.3 and this error will be eliminated. You don't need to replace the categories_dressing_defines.php; there might be some new stock defines you could add to that file, I don't remember exactly what changed between those versions. You would need to make the correct settings to activate the desired switch case in the new categories_dressing_functions.php. See the readme for more info.
Re: Annoying Home Page Validation (Just one Error)
Thanks for replying Glen. I tried to upgade to the latest version some time ago and it was proving a bit tricky for me. Can't remember exactly what it was doing but it was going to take me a while to try and fix it back to how we need it. Is there a simpler way to just inset a closing </ul> in the file to fix the validation error as I'd prefer to just stick with the v.2.6 which works beautifully, otherwise.
Re: Annoying Home Page Validation (Just one Error)
Compare these functions... you may be able to just swap the newer one in.
V2.6:
PHP Code:
function cat_ul_manage($current_path, &$prev_cat_depth, $new_group) {
$ul_content = '';
$cat_depth = substr_count($current_path,'_');
if ($cat_depth > $prev_cat_depth) {
$ul_content .= str_repeat('<ul>',(($cat_depth - $prev_cat_depth) - $new_group)) . "\n";
} elseif ($cat_depth < $prev_cat_depth) {
$ul_content .= str_repeat('</ul>',(($prev_cat_depth - $cat_depth) + $new_group)) . "\n";
} else {
$ul_content .= $new_group?'</ul>':'';
}
$ul_content .= $new_group?'<ul id="catGroup' . $current_path . '">' . "\n":'';
$prev_cat_depth = $cat_depth;
return $ul_content;
}
V2.7.3:
PHP Code:
function cat_ul_manage($current_path, &$prev_cat_depth, $new_group) {
$ul_content = '';
$cat_depth = substr_count($current_path,'_');
$group_id = ' id="catGroup' . $current_path . '"';
if ($prev_cat_depth < 0) {//first item
$ul_content .= str_repeat("\n" . '<ul><li>',$cat_depth) . "\n" . '<ul' . $group_id . '>' . "\n";
} else {
if ($cat_depth > $prev_cat_depth) {//deeper
$ul_content .= str_repeat('<ul><li>',($cat_depth - $prev_cat_depth - 1)) . "\n" . '<ul' . $group_id . '>' . "\n";
} elseif ($cat_depth < $prev_cat_depth) {//higher
$ul_content .= str_repeat('</li>' . "\n" . '</ul>',($prev_cat_depth - $cat_depth)) . ($new_group?'</li>' . "\n" . '</ul>' . ($cat_depth > 0? '</li>' . "\n" . ' <li>':'') . "\n" . '<ul' . $group_id . '>':'</li>') . "\n";
} else {//no depth change
$ul_content .= '</li>' . ($new_group?"\n" . '</ul>' . ($cat_depth > 0? '</li>' . "\n" . ' <li>':'') . "\n" . '<ul' . $group_id . '>':'') . "\n";
}
}//if
$prev_cat_depth = $cat_depth;
return $ul_content;
}
Re: Annoying Home Page Validation (Just one Error)
Your tpl_categories.php should have this line just below the top comments:
PHP Code:
$prev_cat_depth = -1;//do not alter
If it is not like that, replace the original with this version.