Div "term-container" not correctly displayed

duser - January 18, 2007 - 04:00
Project:Taxonomy context
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

Hi,
at difference of "vocabulary container", the div "term-container" isn't correctly displayed.

Example 1, correct (output of a page as http://www.mywebsite.com/taxonomy/vocabulary/1):

..<div class="vocabulary-container">
....<div class="vocabulary">
......<div class="description"></div>

......<div class="subterm-container">
........<div class="subterm">
..........<h2 class="title"></h2>
..........<div class="description"></div>
........</div>
......</div>
......<div class="subterm-container">
........<div class="subterm">
..........<h2 class="title"></h2>
..........<div class="description"></div>
........</div>
......</div>

....</div>
..</div>

Example 2, not correct (output of a term's page under any vocabulary):

..<div class="term-container">
....<div class="term">
......<div class="description"></div>
....</div>
..</div>

..<div class="subterm-container">
....<div class="subterm">
......<h2 class="title"></h2>
......<div class="teaser"></div>
....</div>
..</div>

..<div class="subterm-container">
....<div class="subterm">
......<h2 class="title"></h2>
......<div class="teaser"></div>
....</div>
..</div>

* Subterm's divs are'nt children of "term-container" (as happens with the div "vocabulary-container")

Thx in advance.

#1

nedjo - January 23, 2007 - 04:29

Sure. A patch would be welcome.

#2

duser - February 4, 2007 - 20:16

It should be easy but unfortunately I don't know whether to do.

I think that this is the code that should be edited:

/**
* Theme a term output.
*/
function theme_taxonomy_context_term($term) {
  $type = $term->subterm ? 'subterm' : 'term';
  $output = '';
  $output .= "<div class=\"$type-container\">\n";
  $output .= "  <div class=\"$type\">\n";
  if ($term->subterm) {
    $output .= '   <h2 class="title">' . l($term->name, taxonomy_term_path($term)) . "</h2>\n";
  }
  if ($term->teaser) {
    $output .= '   <div class="teaser">' . $term->teaser . "</div>\n";
  }
  else {
    $output .= '   <div class="description">' . $term->description . "</div>\n";
  }
  if ($term->links) {
    $output .= '   <div class="links">'. theme('links', $term->links) . "</div>\n";
  }
  $output .= "  </div>\n";
  $output .= "</div>\n";
  return $output;
}

And this is the code that generate the vocabulary container (correctly):

/**
* Theme a vocabulary output.
*/
function theme_taxonomy_context_vocabulary($vocabulary) {
  $output .= "<div class=\"vocabulary-container\">\n";
  $output .= "  <div class=\"vocabulary\">\n";
  $output .= '   <div class="description">' . $vocabulary->description . "</div>\n";
  if ($vocabulary->links) {
    $output .= '   <div class="links">'. theme('links', $vocabulary->links) . "</div>\n";
  }
  if ($vocabulary->terms && is_array($vocabulary->terms)) {
    foreach($vocabulary->terms as $term) {
      $term->subterm = TRUE;
      $output .= theme('taxonomy_context_term', $term);
    }
  }
  $output .= "  </div>\n";
  $output .= "</div>\n";

  return $output;
}

#3

NancyDru - February 26, 2009 - 17:53
Status:active» postponed (maintainer needs more info)

Is this still a problem with Version 2?

 
 

Drupal is a registered trademark of Dries Buytaert.