Ardi Coetzee
Ardi Coetzee

Reputation:

Drupal 6: Taxonomy splot up in managed fields?

So you have two taxonomies, namely: "Business Type" and "Location"

This is assigned to a node called BUSINESS. In effect, when the user creates a BUSINESS node, her has to choose for example, location "New York" and type "Information Services". My problem is when: a) Capturing the taxonomy, and b) Displaying the taxonomy

I want the two terms to be separated from each other. I.e. I want to be able to move the two terms individual positions in the MANAGE FIELDS view, so that they can be grouped or placed seperately. Currently, Drupal only allows one entry, called "TAXONOMY" which is effectively the two terms next to each other.

This is what I have: alt text http://www.namhost.com/have.jpg

This is what I want: alt text

Bare in mind, I need to be able to use this with Hierarchical Select, which means Content Taxonomy is not an option.

Upvotes: 0

Views: 651

Answers (3)

avibrazil
avibrazil

Reputation: 330

You'll have to separate your problem in 2 parts:

  • The form filling part, which will have all vocabularies together to the editor.
  • The content display part, which you'll be able to separate vocabularies.

I'll cover here more the second part, about displaying.

Use the CCK computed field module and create one field for each vocabulary you want to display. Position this field where you want them.

Configure each field as follows:

  1. On the Computed Code, put something like this:
    # Get vocabulary ID from its management URL (/admin/content/taxonomy/edit/vocabulary/[VOCABULARY_ID]) and set here:

$node_field[0]['value'] = "5";

# Also, configure this field as 'Raw Text' on Display Fields
  1. On Display Format, use this:
    $vocabulary_id=$node_field_item['value'];

$terms=taxonomy_node_get_terms_by_vocabulary($element['#node'], $vocabulary_id);

foreach ($terms as $tid => $details) {
      # The taxonomy_get_textual_term_hierarchy_by_id() is implemented on the SolutionHub's theme template.php file
      $textualTerms .= taxonomy_get_textual_term_hierarchy_by_id($tid);
}

if (isset($textualTerms)) {
      $display='';
      $display.=$textualTerms;
      $display.='';
}

The taxonomy_get_textual_term_hierarchy_by_id() function is specific to my site and is defined in DRUPAL_ROOT/sites/default/themes/mytheme/template.php and simply rewrites the taxonomy term text in a fancy way to show its entire lineage. So instead of "apple" I'll get something like "food > desert > fruit > apple". I won't paste it here cause it is out of scope.

If your problem is to reposition the vocabulary in the edit form, I would suggest the Content Taxonomy module.

Upvotes: 1

Capi Etheriel
Capi Etheriel

Reputation: 3640

maybe you could do better with cck. by enabling text (comes with cck) you can add text fields. and you can easily use them separately, use them with views, templates, etc.

Upvotes: 0

Stay-at-home-dad
Stay-at-home-dad

Reputation: 886

You are stuck with the two taxonomies appearing together in the input form, they come as a package. Taxonomy should be used as a classification system (like animal kingdom classifications) so the terms to belong together in physical space.

But for the other half of your question, keep in mind your users will see the 'Business type' and 'Location' labels in the input form, not the generic 'Taxonomy' label that you see when managing fields.

Upvotes: 0

Related Questions