Incorrect HTML structure for nested lists

Peter Bex - November 5, 2009 - 20:50
Project:Taxonomy Block
Version:6.x-1.0-beta2
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed
Issue tags:markup, nesting, structure
Description

The UL/LI structure is not correct according to the HTML standard; nested ULs for child terms are directly in the parent UL of a taxonomy term. Instead, they should be inside the LI item that corresponds to the terms' parent.

Attached is a trivial patch that fixes this.

AttachmentSize
taxonomy_block.html-nesting-fix.patch786 bytes

#1

drupal-id.com - November 11, 2009 - 08:17
Status:active» closed

Nothing wrong with the code:

        $output .= '<li>';
        if (module_exists("i18n")) {
          $output .= l(tt("taxonomy:term:$tid_parent:name", $name_parent), "taxonomy/term/$tid_parent");
        } else {
          $output .= l(t($name_parent), "taxonomy/term/$tid_parent"); 
        }
        if ($node_count) {
          $total_parent = db_result(db_query("SELECT COUNT(nid) FROM {term_node} WHERE tid = %d", $tid_parent));
          $output .= " ($total_parent)";
        }
        $output .= "</li>";   // This line needed to close the first <li> tag

 
 

Drupal is a registered trademark of Dries Buytaert.