marksie1988 Posted July 24, 2008 Share Posted July 24, 2008 hi, i have created a menu using an array but now we have the need to have sub menus which would change only once the link for that section was clicked. i have managed to get the sub menu working but as you can see depending on wether the page is selected depends on the button style. the issue i have is that the style isnt applying to the submenu, how would i be able to do this i have been trying for ages but its just confusing me. <?php $serviceLinks = array (1 =>"?subSelection=Network Services", "?subSelection=Project Management", "?subSelection=Managed Services", "?subSelection=Storage Management", "?subSelection=Virtualisation", "?subSelection=Migration Services", "?subSelection=Outsourcing", "?subSelection=Installation", "?subSelection=Telecoms", "?subSelection=Software Development", "?subSelection=Disposal Services", "?subSelection=Website Solutions" "?subSelection=IT Compliance", "?subSelection=Referrals" ); $sideNavLinks["service"] = $serviceLinks; //////////////////////////////// $subsel = $_REQUEST['subSelection']; if($subsel == 'Network Services'){ $serviceTitle = array (1 => "Back To Services", "Network Design", "WAN Optimisation", "Wireless Networking", "Installation & Cabling", "Home Workers & VPN's" ); $sideNavTitles["service"] = $serviceTitle; $serviceLinks = array (1 =>"allservices.php", "?subSelection=Network Services&sub=Network Design", "?subSelection=Network Services&sub=WAN Optimisation" , "?subSelection=Network Services&sub=Wireless Networking", "?subSelection=Network Services&sub=Installation", "?subSelection=Network Services&sub=Home Workers" ); $sideNavLinks["service"] = $serviceLinks; } if($subsel == 'Website Solutions'){ $serviceTitle = array (1 => "Back To Services", "Website Hosting", "Website Design", "Domain Name Registration"); $sideNavTitles["service"] = $serviceTitle; $serviceLinks = array (1 =>"allservices.php", "?subSelection=Website Solutions&sub=Website Hosting", "?subSelection=Website Solutions&sub=Website Design" , "?subSelection=Website Solutions&sub=Domain Name", ); $sideNavLinks["service"] = $serviceLinks; } //////////////////////////////// //////////////////////////////// //////////////////////////////// $tVar = $sideNavTitles[$thisPage]; $noLinks = count($tVar); for ($x=1;$x<($noLinks+1);$x++) { if ( $sideNavSelected == $tVar[$x] ) { ?> <div class="sidenavbar"><span> <?php echo "$tVar[$x]"; ?> </span></div> <?php } else { ?> <div class="sidenavbar"><a href=" <?php $tVar = $sideNavLinks[$thisPage]; echo "$tVar[$x]"; ?> "> <?php $tVar = $sideNavTitles[$thisPage]; echo "$tVar[$x]"; ?> </a></div> <?php } } ?> Link to comment https://forums.phpfreaks.com/topic/116406-array-menu-system-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.