Download & Extend

Incorrect structure in displayed term list when depth decreases more than one level

Project:Taxonomy Blocks
Version:6.x-1.0-beta2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

When depth of the term decreases more than one level (for example 3->1) the level of the list items is not decreased according to that.

I applied the following patch to fix this issue:

Line 150 ff

Original code:

<?php
       
elseif ($term->depth < $old_depth) {
         
$output .= '</ul>';
        }
?>

Patched Code:
<?php
       
elseif ($term->depth < $old_depth) {
         
$output .= '</ul>';
         
$depthval=$term->depth +1;
         
//if new depth is more than one less than last  </ul> are added until target level reached
         
while ($depthval<$old_depth)
          {
           
$output .= '</ul>';
           
$depthval=$depthval+1;
          }
?>

Perhaps it is not necessary to use additional variable $depthval and instead decrease $old_depth, but I didn't check the whole code and didn't want to mess things up...

Comments

#1

Status:patch (to be ported)» needs review

#2

Thanks det21.
I took it a step further and closed the list items as well </li>

<?php
 
elseif ($term->depth < $old_depth) { 
   
$output .= '</li></ul>';
   
$depthval=$term->depth +1;
   
//if new depth is more than one less than last  </ul> are added until target level reached
   
while ($depthval<$old_depth) {
     
$output .= '</li></ul>';
     
$depthval=$depthval+1;
    }
   
$output .= '</li>';
  }
?>

#3

Version:6.x-1.0-beta1» 6.x-1.0-beta2

Same issue still present in the newest release.