taxonomy_html_vocab_horiz() forgets ending </li> if the last item is an empty term

mikesmullin - April 4, 2007 - 22:23
Project:Taxonomy HTML
Version:HEAD
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Block outputs:

<ul>
<li class="leaf"><a href="/categories/community/real-estate">Real Estate</a></li>
<li class="leaf">Senior News</li>
<li class="leaf"><a href="/categories/community/special-events">Special Events</a></li>
<li class="leaf">Sports
</ul>

Notice the missing </li> tag?

See attached patch for the fix.

Found this one as a result of W3C Validation errors.

AttachmentSize
taxonomy_html.module_1.patch1.72 KB

#1

mikesmullin - April 4, 2007 - 22:30

Aparrently this happens to non-empty items, as well.

So you'll also need to change line 101 from:

      $output .= '<li class="' . $class . '">' . l($term->name .($showcounts ? ' ('. $term->count .')' : ''), 'taxonomy/term/' . $term->tid . ($type == 'feed' ? '/feed' : ''), ($showcounts ? array("title" => format_plural($term->count, '1 item', '%count items')) : array()));

to:

      $output .= '<li class="' . $class . '">' . l($term->name .($showcounts ? ' ('. $term->count .')' : ''), 'taxonomy/term/' . $term->tid . ($type == 'feed' ? '/feed' : ''), ($showcounts ? array("title" => format_plural($term->count, '1 item', '%count items')) : array())) . ($index==$last-1? '</li>' : '');

#2

NancyDru - February 2, 2008 - 03:15

The project page says this module is not being maintained any longer. If you really want it over the alternatives, let me know because I'm sure Gabor would let me have it.

#3

NancyDru - February 2, 2008 - 03:16
 
 

Drupal is a registered trademark of Dries Buytaert.