Welcome Guest, Not a member yet? Register   Sign In
Hierarchical <ul><li> from MySql
#12

[eluser]gtlitc[/eluser]
I really dig the idea of using a recursice function to build my site menus but I have am having a problem and have been banging my head for ages now.
I need my menu function to return a nested list as per the above examples but I dont want non-active irelevent elements of the tree to be displayed.

For example here is an example menu with all elements shown:
Code:
<ul>
    <li><a href="1.html">link 1</a>
        <ul>
            <li><a href="1-1.html">link 1-1</a>
            <li><a href="1-2.html">link 1-2</a>
        </ul>
    </li>
    <li><a href="2.html">link 2</a>
        <ul>
            <li><a href="2-1.html">link 2-1</a>
            <li><a href="2-2.html">link 2-2</a>
        </ul>
    </li>
    <li><a href="3.html">link 3</a></li>
</ul>

But if the current page is 1-2.html I want to have a menu like this:

Code:
<ul>
    <li><a href="1.html">link 1</a>
        <ul>
            <li><a href="1-1.html">link 1-1</a>
            <li><a href="1-2.html">link 1-2</a>
        </ul>
    </li>
    <li><a href="2.html">link 2</a></li>
    <li><a href="3.html">link 3</a></li>
</ul>

Evidently I would pass either the ID or the name of the current page to the Menu function.
Any ideas? Anyone? Please help me. You may be the only one that can help me now?


Messages In This Thread
Hierarchical <ul><li> from MySql - by El Forum - 12-15-2007, 04:51 PM
Hierarchical <ul><li> from MySql - by El Forum - 12-16-2007, 02:25 AM
Hierarchical <ul><li> from MySql - by El Forum - 12-16-2007, 09:22 PM
Hierarchical <ul><li> from MySql - by El Forum - 12-16-2007, 09:40 PM
Hierarchical <ul><li> from MySql - by El Forum - 12-17-2007, 04:20 PM
Hierarchical <ul><li> from MySql - by El Forum - 12-18-2007, 06:00 AM
Hierarchical <ul><li> from MySql - by El Forum - 12-18-2007, 08:53 AM
Hierarchical <ul><li> from MySql - by El Forum - 12-18-2007, 09:04 AM
Hierarchical <ul><li> from MySql - by El Forum - 12-20-2007, 02:01 AM
Hierarchical <ul><li> from MySql - by El Forum - 10-25-2009, 01:49 PM
Hierarchical <ul><li> from MySql - by El Forum - 10-26-2009, 04:14 AM
Hierarchical <ul><li> from MySql - by El Forum - 08-04-2010, 09:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB