Welcome Guest, Not a member yet? Register   Sign In
Ul LI Menu creation using foreach loop
#1

[eluser]Paleleaves[/eluser]
Hi,

Anybody can give a hand to create a UL LI menu using foreach loop. Values are already there, only need the help to create the menu levels.

Below is the static code of the menu.

Code:
<ul> &lt;!-- This is outer portion. No need to add in the loop --&gt;

<li class="current">
    <a href="#ab">menu item</a>
        <ul>
            <li class="current"><a href="#">menu item</a></li>
            <li><a href="#aba">menu item</a></li>
            <li><a href="#abb">menu item</a></li>
            <li><a href="#abc">menu item</a></li>
            <li><a href="#abd">menu item</a></li>
        </ul>

</li>

</ul> &lt;!-- End of uuter portion. No need to add in the loop --&gt;

Please see the attached file for how the result looks. Anybody can give a foreach loop sample code it would be great! Thanks in advance
#2

[eluser]Maurice Calhoun[/eluser]
Have you tried this.... http://codeigniter.com/wiki/Generatic_List_Generator/
#3

[eluser]nuwanda[/eluser]
It's basic php.

You need to start with an array of your li items.

Then loop over the array, constructing each li with the contents of the array.
#4

[eluser]Paleleaves[/eluser]
Yes, I don't understand the table structure they recommened for this helper.

http://codeigniter.com/wiki/Generatic_List_Generator/

Is it a single table or multiple table.

In my case I'm creating the menu using two different tables but linked.




Theme © iAndrew 2016 - Forum software by © MyBB