Re: logic with arrays

From: Date: Thu, 16 Dec 2004 03:25:52 +0000
Subject: Re: logic with arrays
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-204464@lists.php.net to get a copy of this message
Wee Keat wrote:
Hey Jeff, How are you mate? Was lazying around and saw your email to the list. :) What exactly do you need help with? Is it the following line?
         // Stuck here
         $html_menu .= "<li><a href=\"Need to get value\">$sub_page</a></li>";
       }
       $html_menu .= '</ul>';
Do you need to get the value of the link and the name of the link? If so, try this: ===== begin snippet ======= $html_menu .= '<ul id="subnav">';
     foreach ($menu_page[$menu_name[1]] as $sub_page => $sub_link)
       {
         // Stuck here
         $html_menu .= "<li><a href=\"$sub_link\">$sub_page</a></li>";
       }
       $html_menu .= '</ul>';
     }
===== end snippet ========= What about using recursive functions? I think it's easier as you can create unlimited numbers of sub-menus. It's slow though. Ah Thanks Keat long time no hear/see ...... it works now. :-)
How are you keeping anyway ? You totally ignore us now at phpMelb :-( Come along to our next meeting on 13th Jan 2005 cheers, Jeffery

« previous php.general (#204464) next »