![]() |
Not Looping through full array.
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
PHP Code:
|
variable scope... your function can not 'see' $menu_menu
so either use global PHP Code:
PHP Code:
|
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,
PHP Code:
|
Still trying to solve this with not much luck ,my new array looks like this which i think is a valid type of array.
PHP Code:
PHP Code:
Code:
HCode:
<li><a href='H'>H</a>Code:
<ul id="nav"> |
Trying this loop now. I think I am on the right track but just cant get it to work.
PHP Code:
Code:
<ul id="nav_menu"> |
PHP Code:
|
Thanks Poyzn.
I'v been working on my own loop since and I'm getting a similar result to your's. PHP Code:
Code:
<ul id="nav_menu"><!-- Unordered List Start 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 Code:
<li><a href='H'>H</a></li> |
Quote:
Quote:
|
The the following code:
PHP Code:
|
That new loop gives same result no closing </li> tags
This is all i have that is to do with main_menu PHP Code:
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. Code:
HOME PAGE |
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. PHP Code:
Edit: 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. Edit: err , think this is 'right' way... PHP Code:
|
| All times are GMT +1. The time now is 05:55 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.