Jump to content

PHP submenu


raivis

Recommended Posts

Hi!

I am trying to make a menu with submenu.
I have a idea to keap all manu and submenu datas in file menu.txt

[quote]$lines = file("menu.txt");
foreach($lines as $line_num => $line){
  list($id,[color=#FF6666]$menu[/color])=explode('|', $line);
[color=#663366][i]/*
here in each line it gives to variables $id and $menu the value separated by symbol "|"
next I need: when $_GET['id']=="news", to define and print variable values by concrete line. It must look like:[/i][/color][list]
[*][color=#663366][i]photo-Photo[/i][/color]
[*][color=#663366][i]video-Video[/i][/color]
[*][color=#663366][i]www-WEB Design[/i][/color]
[/list][color=#663366][i] */[/i][/color]
  [color=#FF6666]foreach($lines as simbols "#" => $menu){
[i]//    list($menu2) = explode('#', [b]$menu[/b]);[/i][/color]
[i]//    list($menu2_href,$menu2_name) = explode(':', $menu2);[/i]
      if($_GET['id']==$id){
        echo "<li>".$menu2_href."-".$menu2_name.;
      }
  [color=#FF6666]}[/color]
}[/quote][i][u]File menu.txt store:[/u][/i]
[color=#006600]news|photo:Photo#video:Video#www:WEB Design|
services|photo:Photo#www:WEB Design|
contacts||[/color]


I hope you will have some ideas or suggestions how to develope this code.
Thanks very much!
Link to comment
https://forums.phpfreaks.com/topic/27976-php-submenu/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.