...

View Full Version : Not Looping through full array.



trazix
11-11-2012, 07:18 PM
First is this Array code valid, I think it's probably not. What I am trying to do is loop through the array to build a Navigation Menu. The buildMenu function will loop the main_menu array but not the sub_menu array, I'm just a PHP Learner and am lost with this any help would be great. Thanks



//MENU ARRAY
$main_menu[0] = array('name' => 'HOME PAGE', 'link' => 'index.php');
$main_menu[1] = array('name' => 'MENU 2', 'link' => 'index.php?id=2');
$main_menu[2] = array('name' => 'MENU 3', 'link' => 'index.php?id=3');
$main_menu[3] = array('name' => 'MENU 4', 'link' => 'index.php?id=4');
$main_menu[4] = array('name' => 'MENU 5', 'link' => 'index.php?id=5');

$menu_menu[1] = Array(
'sub_menu' => Array('name' => 'SUB MENU 1', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 2', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 3', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 4', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 5', 'link' => 'index.php'),
);

$menu_menu[2] = Array(
'sub_menu' => Array('name' => 'SUB MENU 1', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 2', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 3', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 4', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 5', 'link' => 'index.php'),
);


function buildMenu($main_menu)
{
foreach ($main_menu as $key => $list)
{
echo "\n<li><a href='". $list['link'] ."'>". $list['name'] ."</a>";
if ( ! empty($key['sub_menu'])) {
echo "<ul>";
buildMenu($key['sub_menu']);
echo "</ul>";
}
echo "</li>";
}
}

firepages
11-12-2012, 08:25 AM
variable scope... your function can not 'see' $menu_menu

so either use global


function buildMenu($main_menu){
global $menu_menu;


or pass both arrays to the function



function buildMenu($main_menu,$menu_menu)
{
foreach ($main_menu as $key => $list)
{
echo "\n<li><a href='". $list['link'] ."'>". $list['name'] ."</a>";
if ( ! empty($key['sub_menu'])) {
echo "<ul>";
buildMenu($key['sub_menu'],$menu_menu);
echo "</ul>";
}
echo "</li>";
}
}


I have not actually tested the loop but thats the main issue

trazix
11-16-2012, 03:16 PM
Thanks for the reply firepages, however no joy. I'v made a boo boo in the Array I posted. It should have looked like this,



//MENU ARRAY
$main_menu[0] = array('name' => 'HOME PAGE', 'link' => 'index.php');
$main_menu[1] = array('name' => 'MENU 2', 'link' => 'index.php?id=2');
$main_menu[2] = array('name' => 'MENU 3', 'link' => 'index.php?id=3');
$main_menu[3] = array('name' => 'MENU 4', 'link' => 'index.php?id=4');
$main_menu[4] = array('name' => 'MENU 5', 'link' => 'index.php?id=5');

$main_menu[1] = Array(
'sub_menu' => Array('name' => 'SUB MENU 1', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 2', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 3', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 4', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 5', 'link' => 'index.php'),
);

$main_menu[2] = Array(
'sub_menu' => Array('name' => 'SUB MENU 1', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 2', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 3', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 4', 'link' => 'index.php'),
'sub_menu' => Array('name' => 'SUB MENU 5', 'link' => 'index.php'),
);


Would this be a valid multidimensional array.

trazix
11-18-2012, 04:47 PM
Still trying to solve this with not much luck ,my new array looks like this which i think is a valid type of array.



//MAIN MENU ARRAY
$main_menu[0] = array('name' => 'HOME PAGE', 'link' => 'index.php');
$main_menu[1] = array('name' => 'MENU 2', 'link' => 'index.php?id=2');
$main_menu[2] = array('name' => 'MENU 3', 'link' => 'index.php?id=3');
$main_menu[3] = array('name' => 'MENU 4', 'link' => 'index.php?id=4');
$main_menu[4] = array('name' => 'MENU 5', 'link' => 'index.php?id=5');
//SUB MENU ARRAY
$main_menu[1][0] = array('name' => 'Sub Menu 1', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[1][1] = array('name' => 'Sub Menu 2', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[1][2] = array('name' => 'Sub Menu 3', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[1][3] = array('name' => 'Sub Menu 4', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[1][4] = array('name' => 'Sub Menu 5', 'link' => 'index.php?id=xxxxxxxxxxx');
//SUB MENU ARRAY
$main_menu[2][0] = array('name' => 'Sub Menu 1', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[2][1] = array('name' => 'Sub Menu 2', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[2][2] = array('name' => 'Sub Menu 3', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[2][3] = array('name' => 'Sub Menu 4', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[2][4] = array('name' => 'Sub Menu 5', 'link' => 'index.php?id=xxxxxxxxxxx');




foreach ($main_menu as $key => $keyValue) {
foreach ($keyValue as $keyValuex) {
echo "\n<li><a href='". $keyValuex['link'] ."'>". $keyValuex['name'] ."</a>";
}
}

When I try this foreach loop I get output like.



H
i
M
i
Sub Menu 1
Sub Menu 2
Sub Menu 3
Sub Menu 4
Sub Menu 5
M
i
Sub Menu 1
Sub Menu 2
Sub Menu 3
Sub Menu 4
Sub Menu 5
M
i
M
i


Html source code.


<li><a href='H'>H</a>
<li><a href='i'>i</a>
<li><a href='M'>M</a>
<li><a href='i'>i</a>
<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 1</a>
<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 2</a>
<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 3</a>
<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 4</a>
<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 5</a>
<li><a href='M'>M</a>
<li><a href='i'>i</a>
<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 1</a>
<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 2</a>
<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 3</a>
<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 4</a>
<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 5</a>
<li><a href='M'>M</a>
<li><a href='i'>i</a>
<li><a href='M'>M</a>

What I would like is to have the foreach loop output a unordered list code like this.



<ul id="nav">

<li><a href="index.php">Home</a></li>

<li><a class="hsubs" href="index.php?id=1">Menu 1</a>
<ul class="subs">
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 1</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 2</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 3</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 4</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 5</a></li>
</ul>
</li>

<li><a class="hsubs" href="index.php?id=2">Menu 2</a>
<ul class="subs">
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 2-1</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 2-2</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 2-3</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 2-4</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 2-5</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 2-6</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 2-7</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 2-8</a></li>
</ul>
</li>

<li><a class="hsubs" href="index.php?id=3">Menu 3</a>
<ul class="subs">
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 3-1</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 3-2</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 3-3</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 3-4</a></li>
<li><a href="index.php?id=xxxxxxxxxxx">Submenu 3-5</a></li>
</ul>
</li>

<li><a href="index.php?id=4">Menu 4</a></li>

<li><a href="index.php?id=5">Menu 5</a></li>

<li><a href="index.php?id=6">Menu 6</a></li>

<li><a href="index.php">Back</a></li>
</ul>

This is beyond my current php abilities.

trazix
11-18-2012, 06:04 PM
Trying this loop now. I think I am on the right track but just cant get it to work.


echo "<ul id=\"nav_menu\">";

foreach ($main_menu as $key => $keyValue)
{
echo "\n<li class=\"YYYY\"><a href='". $keyValue['link'] ."'>". $keyValue['name'] ."</a>";
{ echo "</li><ul class=\"XXXX\">";
foreach ($keyValue as $keyValuex) {
echo "\n<ul class=\"ZZZZ\"><li><a href='". $keyValuex['link'] ."'>". $keyValuex['name'] ."</a></li>";

}
}
echo "</ul>";
}
echo "</ul>";


This is the source code i am getting, the <ul> tags are not in the right places.


<ul id="nav_menu">
<li class="YYYY"><a href="index.php">HOME PAGE</a></li><ul class="XXXX">
<ul class="ZZZZ"><li><a href="H">H</a></li>
<ul class="ZZZZ"><li><a href="i">i</a></li></ul>
<li class="YYYY"><a href="index.php?id=2">MENU 2</a></li><ul class="XXXX">
<ul class="ZZZZ"><li><a href="M">M</a></li>
<ul class="ZZZZ"><li><a href="i">i</a></li>
<ul class="ZZZZ"><li><a href="index.php?id=xxxxxxxxxxx">Sub Menu 1</a></li>
<ul class="ZZZZ"><li><a href="index.php?id=xxxxxxxxxxx">Sub Menu 2</a></li>
<ul class="ZZZZ"><li><a href="index.php?id=xxxxxxxxxxx">Sub Menu 3</a></li>
<ul class="ZZZZ"><li><a href="index.php?id=xxxxxxxxxxx">Sub Menu 4</a></li>
<ul class="ZZZZ"><li><a href="index.php?id=xxxxxxxxxxx">Sub Menu 5</a></li></ul>
<li class="YYYY"><a href="index.php?id=3">MENU 3</a></li><ul class="XXXX">
<ul class="ZZZZ"><li><a href="M">M</a></li>
<ul class="ZZZZ"><li><a href="i">i</a></li>
<ul class="ZZZZ"><li><a href="index.php?id=xxxxxxxxxxx">Sub Menu 1</a></li>
<ul class="ZZZZ"><li><a href="index.php?id=xxxxxxxxxxx">Sub Menu 2</a></li>
<ul class="ZZZZ"><li><a href="index.php?id=xxxxxxxxxxx">Sub Menu 3</a></li>
<ul class="ZZZZ"><li><a href="index.php?id=xxxxxxxxxxx">Sub Menu 4</a></li>
<ul class="ZZZZ"><li><a href="index.php?id=xxxxxxxxxxx">Sub Menu 5</a></li></ul>
<li class="YYYY"><a href="index.php?id=4">MENU 4</a></li><ul class="XXXX">
<ul class="ZZZZ"><li><a href="M">M</a></li>
<ul class="ZZZZ"><li><a href="i">i</a></li></ul>
<li class="YYYY"><a href="index.php?id=5">MENU 5</a></li><ul class="XXXX">
<ul class="ZZZZ"><li><a href="M">M</a></li>
<ul class="ZZZZ"><li><a href="i">i</a></li></ul></ul>

poyzn
11-18-2012, 06:44 PM
echo "<ul id=\"nav_menu\">";

foreach ($main_menu as $key => $keyValue)
{
echo "\n<li class=\"YYYY\"><a href='". $keyValue['link'] ."'>". $keyValue['name'] ."</a>";
echo "\n<ul class=\"XXXX\">";
foreach ($keyValue as $keyValuex)
{
echo "\n<li><a href='". $keyValuex['link'] ."'>". $keyValuex['name'] ."</a></li>";
}
echo "</ul></li>";
}
echo "</ul>";

trazix
11-18-2012, 07:18 PM
Thanks Poyzn.
I'v been working on my own loop since and I'm getting a similar result to your's.


echo "\n\n\n<ul id=\"nav_menu\"><!-- Unordered List Start Tag -->\n";

foreach ($main_menu as $key => $keyValue)
{
echo "\n<li class=\"main_menu\"><a href='". $keyValue['link'] ."'>". $keyValue['name'] ."</a>";
{ echo "\n\n<ul class=\"sub_menu\">\n";
foreach ($keyValue as $keyValuex) {
echo "\n<li><a href='". $keyValuex['link'] ."'>". $keyValuex['name'] ."</a></li>\n";

}
{ echo "</ul><!-- Sub Menu Unordered List Item Closing Tag -->";
}
} { echo"\n</li><!-- Sub Menu List Item Closing Tag -->\n";
//echo "</li>";

}
}
echo "\n</ul><!-- Unordered List End Tag -->\n";




<ul id="nav_menu"><!-- Unordered List Start Tag -->

<li class="main_menu"><a href='index.php'>HOME PAGE</a>

<ul class="sub_menu">

<li><a href='H'>H</a></li>

<li><a href='i'>i</a></li>
</ul><!-- Sub Menu Unordered List Item Closing Tag -->
</li><!-- Sub Menu List Item Closing Tag -->

<li class="main_menu"><a href='index.php?id=2'>MENU 2</a>

<ul class="sub_menu">

<li><a href='M'>M</a></li>

<li><a href='i'>i</a></li>

<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 1</a></li>

<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 2</a></li>

<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 3</a></li>

<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 4</a></li>

<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 5</a></li>
</ul><!-- Sub Menu Unordered List Item Closing Tag -->
</li><!-- Sub Menu List Item Closing Tag -->

<li class="main_menu"><a href='index.php?id=3'>MENU 3</a>

<ul class="sub_menu">

<li><a href='M'>M</a></li>

<li><a href='i'>i</a></li>

<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 1</a></li>

<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 2</a></li>

<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 3</a></li>

<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 4</a></li>

<li><a href='index.php?id=xxxxxxxxxxx'>Sub Menu 5</a></li>
</ul><!-- Sub Menu Unordered List Item Closing Tag -->
</li><!-- Sub Menu List Item Closing Tag -->

<li class="main_menu"><a href='index.php?id=4'>MENU 4</a>

<ul class="sub_menu">

<li><a href='M'>M</a></li>

<li><a href='i'>i</a></li>
</ul><!-- Sub Menu Unordered List Item Closing Tag -->
</li><!-- Sub Menu List Item Closing Tag -->

<li class="main_menu"><a href='index.php?id=5'>MENU 5</a>

<ul class="sub_menu">

<li><a href='M'>M</a></li>

<li><a href='i'>i</a></li>
</ul><!-- Sub Menu Unordered List Item Closing Tag -->
</li><!-- Sub Menu List Item Closing Tag -->

</ul><!-- Unordered List End Tag -->



I have 2 issues, first should the Menu's that dont have a Sub menu array not have closing </li> tag's ,for example the first Home link
<li class="main_menu"><a href='index.php'>HOME PAGE</a>
should it be <li class="main_menu"><a href='index.php'>HOME PAGE</a></li>

The second issue is for some reason the Loop is creating 2 unwanted List items at the start of each UL , example


<li><a href='H'>H</a></li>

<li><a href='i'>i</a></li>

poyzn
11-18-2012, 07:35 PM
I have 2 issues, first should the Menu's that dont have a Sub menu array not have closing </li> tag's ,for example the first Home link
<li class="main_menu"><a href='index.php'>HOME PAGE</a>
should it be <li class="main_menu"><a href='index.php'>HOME PAGE</a></li>


Yes, it should has closing tag



The second issue is for some reason the Loop is creating 2 unwanted List items at the start of each UL , example


<li><a href='H'>H</a></li>

<li><a href='i'>i</a></li>


Show your $main_menu variable.

poyzn
11-18-2012, 07:39 PM
The the following code:



<?

echo "\n\n\n<ul id=\"nav_menu\"><!-- Unordered List Start Tag -->\n";

foreach ($main_menu as $key => $keyValue)
{
echo "\n<li class=\"main_menu\"><a href='". $keyValue['link'] ."'>". $keyValue['name'] ."</a>";
if(is_array($keyValue))
{
echo "\n\n<ul class=\"sub_menu\">\n";
foreach ($keyValue as $keyValuex)
{
echo "\n<li><a href='". $keyValuex['link'] ."'>". $keyValuex['name'] ."</a></li>\n";
}
echo "</ul><!-- Sub Menu Unordered List Item Closing Tag -->";
}
echo"\n</li><!-- Sub Menu List Item Closing Tag -->\n";
}
echo "\n</ul><!-- Unordered List End Tag -->\n";

trazix
11-18-2012, 07:42 PM
That new loop gives same result no closing </li> tags


This is all i have that is to do with main_menu


$main_menu[0] = array('name' => 'HOME PAGE', 'link' => 'index.php');
$main_menu[1] = array('name' => 'MENU 2', 'link' => 'index.php?id=2');
$main_menu[2] = array('name' => 'MENU 3', 'link' => 'index.php?id=3');
$main_menu[3] = array('name' => 'MENU 4', 'link' => 'index.php?id=4');
$main_menu[4] = array('name' => 'MENU 5', 'link' => 'index.php?id=5');

$main_menu[1][0] = array('name' => 'Sub Menu 1', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[1][1] = array('name' => 'Sub Menu 2', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[1][2] = array('name' => 'Sub Menu 3', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[1][3] = array('name' => 'Sub Menu 4', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[1][4] = array('name' => 'Sub Menu 5', 'link' => 'index.php?id=xxxxxxxxxxx');

$main_menu[2][0] = array('name' => 'Sub Menu 1', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[2][1] = array('name' => 'Sub Menu 2', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[2][2] = array('name' => 'Sub Menu 3', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[2][3] = array('name' => 'Sub Menu 4', 'link' => 'index.php?id=xxxxxxxxxxx');
$main_menu[2][4] = array('name' => 'Sub Menu 5', 'link' => 'index.php?id=xxxxxxxxxxx');


The H is from the first letter in first array e.g Home Page and the i is from index.php
This is the list of links as seen on webpage.
For some reason the loop is creating two Dud links in each menu list It's using the first letter of each array item.


HOME PAGE

H
i

MENU 2

M
i
Sub Menu 1
Sub Menu 2
Sub Menu 3
Sub Menu 4
Sub Menu 5

MENU 3

M
i
Sub Menu 1
Sub Menu 2
Sub Menu 3
Sub Menu 4
Sub Menu 5

MENU 4

M
i

MENU 5

M
i

firepages
11-19-2012, 06:28 AM
was not sure if your list was going to have sub-sub menus or not ??
if it does this is an example to play with.



<?
$main_menu[] = array('name' => 'HOME PAGE', 'link' => 'index.php');
$main_menu[] = array('name' => 'MENU 2', 'link' => 'index.php?id=2',
'sub'=>array(
array('name' => 'Sub Menu 1', 'link' => 'index.php?id=xxxxxxxxxxx'),
array('name' => 'Sub Menu 2', 'link' => 'index.php?id=xxxxxxxxxxx'),
array('name' => 'Sub Menu 3', 'link' => 'index.php?id=xxxxxxxxxxx'),
array('name' => 'Sub Menu 4', 'link' => 'index.php?id=xxxxxxxxxxx'),
array('name' => 'Sub Menu 5', 'link' => 'index.php?id=xxxxxxxxxxx'),
),
);
$main_menu[] = array('name' => 'MENU 3', 'link' => 'index.php?id=3',
'sub'=>array(
array('name' => 'Sub Menu 1', 'link' => 'index.php?id=xxxxxxxxxxx'),
array('name' => 'Sub Menu 2', 'link' => 'index.php?id=xxxxxxxxxxx'),
array('name' => 'Sub Menu 3', 'link' => 'index.php?id=xxxxxxxxxxx'),
array('name' => 'Sub Menu 4', 'link' => 'index.php?id=xxxxxxxxxxx'),
array('name' => 'Sub Menu 5', 'link' => 'index.php?id=xxxxxxxxxxx'),
)
);
$main_menu[] = array('name' => 'MENU 4', 'link' => 'index.php?id=4',
'sub'=>array(
array('name' => 'Sub Menu 1', 'link' => 'index.php?id=xxxxxxxxxxx'),
array('name' => 'Sub Menu 2', 'link' => 'index.php?id=xxxxxxxxxxx'),
array('name' => 'Sub Menu 3', 'link' => 'index.php?id=xxxxxxxxxxx',
'sub'=>array(
array('name' => 'Sub Sub 1', 'link' => 'index.php?id=xxxxxxxxxxx'),
array('name' => 'Sub Sub 2', 'link' => 'index.php?id=xxxxxxxxxxx'),
)
),
)
);
$main_menu[] = array('name' => 'MENU 5', 'link' => 'index.php?id=5');


function mm($main_menu,&$rets){
$rets.= '<ul>';
foreach($main_menu as $m){
$rets.= '<li>'.$m['name'].'</li>';
if(is_array($m['sub'])){
mm($m['sub'],$rets);
}
}
$rets.= '</ul>';
}

mm($main_menu,$rets);
echo $rets;



hmmmm, works (e.g. displays OK in firefox) but I think my HTML is awry :) , think should be <li>ul>nested list NOT <li>blah></li><ul>nested list .. etc , will have a play and report back.


err , think this is 'right' way...



function mm($main_menu,&$rets){
$rets.= '<ul>';
foreach($main_menu as $m){
$rets.= '<li>'.$m['name'];
if(is_array($m['sub'])){
mm($m['sub'],$rets);
$rets .= '</li>';
}else{
$rets.='</li>';
}
}
$rets.= '</ul>';
}

mm($main_menu,$rets);
echo $rets;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum