1

I'm trying to build a menu using a taxonomy vocabulary with its hierarchical structure. I don't want to use any module to do it.

In this page I see that I can grab the terms for a given vocabulary and do it programmatically http://drupal.org/node/113651

But I need some help to star coding it.

I have a Taxonomy called: Products (the tid is : 2)

Products has the following terms and hierarchical structure:

--Cars
----Volvo
----Ford
--Games
----Football
----Rugby
----Videogames
------Pacman
------Call of Duty

PHP CODE to generate:

<ul>
    <li>Cars
        <ul>
            <li>Volvo</li>
            <li>Ford</li>
        </ul>
    </li>
    <li>Games
        <ul>
            <li> Football </li>
            <li> Rugby </li>
            <li>Cars
                <ul>
                    <li> Pacman </li>
                    <li>Call of Duty</li>
                </ul>
            </li>
        </ul>
    </li>
</ul>
3

That's something I have put together for myself in the past. I posted the code on the Drupal taxonomy_get_tree() API page where you can get a copy for yourself. The core part of the code is usable with Drupal 6 as well (some smaller modifications are needed to make it work though).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.