Search code examples
drupal-6drupal-taxonomydrupal-navigation

drupal taxonomy menu link based on - vocabulary name/term Synonyms


i have a vocabulary that has couple of items each term has a Synonyms. how can i add the vocabulary to one of my menus with the path: vocabulary name/term Synonyms i have looked at taxonomy menu, but cant figure out how to do it using this module or any other. any idea ?


Solution

  • well to all of the 8 people who tried helping me by viewing my question, and all the rest of you out there here's how i did it:

    • i have created a view (which i needed originally) that gets an argument of taxonomy Term ID, added the page display, and gave it path "MY VOCABULARY NAME/%" as described in: taxonomy menu integration with views under the "VIEWS WITH MENU PATH TYPE: CUSTOM" section.
    • under admin/content/taxonomy/edit/vocabulary/1 (the edit vocabulary form) i have made the following Taxonomy menu configuration:
      • set the vocabulary Menu location: Navigation
      • Menu path type: Custom
      • Base path for custom path: MY VOCABULARY NAME

    once that was done my page my navigation menu has links that thier hrefs are "MY VOCABULARY NAME/1", "MY VOCABULARY NAME/2" and so on (one for each vocabulary term).

    here come the tricky part:

    in my theme template.php file i have implemented the function:

    function phptemplate_menu_item_link($link)
    {
       $href = $link['href'];
       $explode_href = explode("/", $link['href']);
      if( 'MY VOCABULARY NAME' == $explode_href[0] ){
        $options = array('attributes' => array('title' => $link['title']));
        return l( $link['title'],'painting-type/' . $link['options']['attributes']['title'], $options);
     }
      return l($link['title'], $link['href'], $link['options']);
    }
    

    after that my navigation menu has links that their hrefs are "MY VOCABULARY NAME/TERM SYNONYMS 1", "MY VOCABULARY NAME/TERM SYNONYMS 2" and so on.

    last i entered the view i created and changed it's argument to be taxonomy Term synonym. after all that, it is working. my vocabulary terms are added to the navigation menu with the href MY VOCABULARY NAME/TERM SYNONYMS and are linked to a view page display. if anyone has a batter solution, I'll be happy to hear. thanks