Re: Annoying Home Page Validation (Just one Error)
When I validated your page and corrected it with HTML tidy and then compared the code with the original I found that it added the extra <li> that I mentioned, adding this allowed the page to validated. Whether that's right or not, could you not try to add this tag as a workaround - unless of course it breaks something?
I mention this without a huge amount of knowledge so apologies if it's a dumb suggestion.
Re: Annoying Home Page Validation (Just one Error)
The code is dynamic and has to allow for a large number of possible ul/li configurations, so there is no one "spot" to just add a <li>.
Re: Annoying Home Page Validation (Just one Error)
Re: Annoying Home Page Validation (Just one Error)
Quote:
Originally Posted by
gjh42
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;
}
Replacing this code makes 51 errors, as opposed to 1.
my tpl_categories.php does not have this line: $prev_cat_depth = -1;//do not alter .... adding it seems to have zero effect.
It's ok Glen, don't waste any more of your time on this as it's just one little error. I know now that it's not just a case of slotting in a <li> somewhere as it's a dynamic code.