Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

display navigation menu

$
0
0
Hi. I want to display menu on my navigation bar using arrays (i know it's probbably lame but who care). I tried this, but it tells me that there are invalid arguments.
public function menu($type){
 foreach($type as $key => $value){
  echo"<li><a href=".$type[$value].">".$type[$key]."</a></li>";
 }
}



i have two arrays $array1 and $array2 which contains few static names like 'link1' 'link2' and their data '?page=1' '?page=2' etc. I want to use function function menu(type) which will display menu based on array of type, for example: menu(array1) will display menu based on array1 which is:
<li><a href='?page=1'>link1</a></li>
<li><a href='?page=2'>link2</a></li>



Am I doing it right (actually there is an error with expression or something) and in good way? or it's better to show menu from database instead array?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>